Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2528097
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 907f7c64b..2c9ef0c26 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -1,53 +1,53 @@
name: tests
on:
push:
pull_request:
jobs:
linux_tests:
runs-on: ubuntu-18.04
if: "!contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[ci skip]')"
strategy:
fail-fast: true
matrix:
php: [5.5, 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0]
name: PHP ${{ matrix.php }}/Linux
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, fileinfo, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, gd, ldap, intl, pspell
tools: composer:v2
coverage: none
- name: Setup problem matchers
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Install Aspell
- run: sudo apt-get -y install aspell aspell-en
+ run: sudo apt-get -y install aspell aspell-en aspell-de
- name: Setup composer
run: |
cp composer.json-dist composer.json
composer require "kolab/net_ldap3:~1.1.1" --no-update
- name: Fix PHPUnit for PHP8
run: composer config platform.php 7.4
if: matrix.php >= 8
- name: Install dependencies
run: composer install --prefer-dist --no-interaction --no-progress
- name: Roundcube configuration
run: cp .github/config-test.inc.php config/config-test.inc.php
- name: Execute tests
run: vendor/bin/phpunit -c tests/phpunit.xml
diff --git a/tests/Framework/Spellchecker.php b/tests/Framework/Spellchecker.php
index feb70090b..03e4daafc 100644
--- a/tests/Framework/Spellchecker.php
+++ b/tests/Framework/Spellchecker.php
@@ -1,122 +1,131 @@
<?php
/**
* Test class to test rcube_spellchecker class
*
* @package Tests
*/
class Framework_Spellchecker extends PHPUnit\Framework\TestCase
{
/**
* Test languages() method
*/
function test_languages()
{
+ if (!extension_loaded('pspell')) {
+ $this->markTestSkipped();
+ }
+
+ rcube::get_instance()->config->set('spellcheck_engine', 'pspell');
+
$object = new rcube_spellchecker();
$langs = $object->languages();
- $this->assertSame('English (US)', $langs['en_US']);
+ $this->assertSame('English (US)', $langs['en']);
}
/**
* Test check() method
*/
function test_check()
{
if (!extension_loaded('pspell')) {
$this->markTestSkipped();
}
rcube::get_instance()->config->set('spellcheck_engine', 'pspell');
$object = new rcube_spellchecker();
$this->assertTrue($object->check('one'));
// Test other methods that depend on the spellcheck result
$this->assertSame(0, $object->found());
$this->assertSame([], $object->get_words());
$this->assertSame(
'<?xml version="1.0" encoding="UTF-8"?><spellresult charschecked="3"></spellresult>',
$object->get_xml()
);
$this->assertFalse($object->check('ony'));
// Test other methods that depend on the spellcheck result
$this->assertSame(1, $object->found());
$this->assertSame(['ony'], $object->get_words());
- $this->assertSame(
- '<?xml version="1.0" encoding="UTF-8"?><spellresult charschecked="3">'
- . '<c o="0" l="3">' . "ON\ton\tOnt\tonly\tonya\tNY\tonyx\tOno\tany\tone</c>"
- . '</spellresult>',
+ $this->assertMatchesRegularExpression(
+ '|^<\?xml version="1.0" encoding="UTF-8"\?><spellresult charschecked="3"><c o="0" l="3">([a-zA-Z\t]+)</c></spellresult>$|',
$object->get_xml()
);
}
/**
* Test get_suggestions() method
*/
function test_get_suggestions()
{
if (!extension_loaded('pspell')) {
$this->markTestSkipped();
}
rcube::get_instance()->config->set('spellcheck_engine', 'pspell');
$object = new rcube_spellchecker();
$expected = ['ON','on','Ont','only','onya','NY','onyx','Ono','any','one'];
- $this->assertSame($expected, $object->get_suggestions('ony'));
+ $result = $object->get_suggestions('ony');
+
+ asort($expected);
+ asort($result);
+
+ $this->assertSame($expected, $result);
}
/**
* Test get_words() method
*/
function test_get_words()
{
if (!extension_loaded('pspell')) {
$this->markTestSkipped();
}
rcube::get_instance()->config->set('spellcheck_engine', 'pspell');
$object = new rcube_spellchecker();
$this->assertSame(['ony'], $object->get_words('ony'));
}
/**
* Test is_exception() method
*/
function test_is_exception()
{
$object = new rcube_spellchecker();
$this->assertFalse($object->is_exception('test'));
$this->assertTrue($object->is_exception('9'));
// TODO: Test other cases and dictionary
}
/**
* Test add_word() method
*/
function test_add_word()
{
$this->markTestIncomplete();
}
/**
* Test remove_word() method
*/
function test_remove_word()
{
$this->markTestIncomplete();
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sun, Feb 1, 1:53 AM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
426591
Default Alt Text
(5 KB)
Attached To
Mode
R3 roundcubemail
Attached
Detach File
Event Timeline
Log In to Comment