Skip to content

Commit

Permalink
General: Update to latest Lunr.Halo
Browse files Browse the repository at this point in the history
  • Loading branch information
pprkut committed Feb 6, 2025
1 parent e388910 commit d1188d5
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 41 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/php-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
phpstan-level: 4
allow-style-failures: false
allow-phpstan-failures: false
codestyle-branch: '0.10.1'
codestyle-branch: '0.10.2'
phpcs-whitelist: tests/phan.config.php tests/phpstan.autoload.inc.php tests/test.bootstrap.inc.php
php-extensions: gettext, uopz
stable-php-versions: '["8.1"]'
Expand Down
6 changes: 3 additions & 3 deletions src/Lunr/L10n/Tests/AbstractL10nBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* @covers Lunr\L10n\AbstractL10n
*/
class AbstractL10nBaseTest extends AbstractL10nTest
class AbstractL10nBaseTest extends AbstractL10nTestCase
{

use PsrLoggerTestTrait;
Expand Down Expand Up @@ -64,7 +64,7 @@ public function testSetInvalidDefaultLanguage(): void

$this->class->set_default_language('Whatever');

$this->assertEquals('en_US', $this->get_reflection_property_value('default_language'));
$this->assertEquals('en_US', $this->getReflectionPropertyValue('default_language'));
}

/**
Expand Down Expand Up @@ -131,7 +131,7 @@ public function testSetInvalidLocalesLocation(): void
}
catch (Throwable $e)
{
$this->assertEquals(TEST_STATICS . '/l10n/', $this->get_reflection_property_value('locales_location'));
$this->assertEquals(TEST_STATICS . '/l10n/', $this->getReflectionPropertyValue('locales_location'));

throw $e;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

namespace Lunr\L10n\Tests;

use Lunr\Halo\LunrBaseTest;
use Lunr\Halo\LunrBaseTestCase;
use Psr\Log\LoggerInterface;

/**
* This class contains test methods for the L10n class.
*
* @covers Lunr\L10n\AbstractL10n
*/
abstract class AbstractL10nTest extends LunrBaseTest
abstract class AbstractL10nTestCase extends LunrBaseTestCase
{

/**
Expand Down Expand Up @@ -52,7 +52,7 @@ public function setUp(): void

parent::baseSetUp($this->class);

$this->set_reflection_property_value('logger', $this->logger);
$this->setReflectionPropertyValue('logger', $this->logger);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Lunr/L10n/Tests/GettextL10nProviderBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @covers Lunr\L10n\GettextL10nProvider
*/
class GettextL10nProviderBaseTest extends GettextL10nProviderTest
class GettextL10nProviderBaseTest extends GettextL10nProviderTestCase
{

/**
Expand All @@ -26,7 +26,7 @@ class GettextL10nProviderBaseTest extends GettextL10nProviderTest
*/
public function testInit(): void
{
$method = $this->get_accessible_reflection_method('init');
$method = $this->getReflectionMethod('init');

$method->invokeArgs($this->class, [ self::LANGUAGE ]);

Expand Down
2 changes: 1 addition & 1 deletion src/Lunr/L10n/Tests/GettextL10nProviderLangTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @covers Lunr\L10n\GettextL10nProvider
*/
class GettextL10nProviderLangTest extends GettextL10nProviderTest
class GettextL10nProviderLangTest extends GettextL10nProviderTestCase
{

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Lunr/L10n/Tests/GettextL10nProviderNlangTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @covers Lunr\L10n\GettextL10nProvider
*/
class GettextL10nProviderNlangTest extends GettextL10nProviderTest
class GettextL10nProviderNlangTest extends GettextL10nProviderTestCase
{

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Lunr\L10n\Tests;

use Lunr\Halo\LunrBaseTest;
use Lunr\Halo\LunrBaseTestCase;
use Lunr\L10n\GettextL10nProvider;
use Psr\Log\LoggerInterface;

Expand All @@ -20,7 +20,7 @@
*
* @covers Lunr\L10n\GettextL10nProvider
*/
abstract class GettextL10nProviderTest extends LunrBaseTest
abstract class GettextL10nProviderTestCase extends LunrBaseTestCase
{

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Lunr/L10n/Tests/L10nBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* @covers Lunr\L10n\L10n
*/
class L10nBaseTest extends L10nTest
class L10nBaseTest extends L10nTestCase
{

use PsrLoggerTestTrait;
Expand Down Expand Up @@ -83,7 +83,7 @@ public function testLanguagesPopulated(): void
*/
public function testCachedGetSupportedLanguages(): void
{
$this->set_reflection_property_value('languages', [ 'de_DE', 'en_US', 'nl_NL' ]);
$this->setReflectionPropertyValue('languages', [ 'de_DE', 'en_US', 'nl_NL' ]);

$languages = $this->class->get_supported_languages();
sort($languages);
Expand Down
2 changes: 1 addition & 1 deletion src/Lunr/L10n/Tests/L10nProviderBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*
* @covers Lunr\L10n\L10nProvider
*/
class L10nProviderBaseTest extends L10nProviderTest
class L10nProviderBaseTest extends L10nProviderTestCase
{

use PsrLoggerTestTrait;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Lunr\L10n\Tests;

use Lunr\Halo\LunrBaseTest;
use Lunr\Halo\LunrBaseTestCase;
use Lunr\L10n\L10nProvider;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\MockObject\Stub;
Expand All @@ -21,7 +21,7 @@
*
* @covers Lunr\L10n\L10nProvider
*/
abstract class L10nProviderTest extends LunrBaseTest
abstract class L10nProviderTestCase extends LunrBaseTestCase
{

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

namespace Lunr\L10n\Tests;

use Lunr\Halo\LunrBaseTest;
use Lunr\Halo\LunrBaseTestCase;
use Lunr\L10n\L10n;

/**
* This class contains test methods for the L10n class.
*
* @covers Lunr\L10n\L10n
*/
abstract class L10nTest extends LunrBaseTest
abstract class L10nTestCase extends LunrBaseTestCase
{

/**
Expand Down
34 changes: 17 additions & 17 deletions src/Lunr/L10n/Tests/PHPL10nProviderBaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@
*
* @covers Lunr\L10n\PHPL10nProvider
*/
class PHPL10nProviderBaseTest extends PHPL10nProviderTest
class PHPL10nProviderBaseTest extends PHPL10nProviderTestCase
{

/**
* Test that the lang_array attribute is empty by default.
*/
public function testLangArrayIsEmptyByDefault(): void
{
$this->assertArrayEmpty($this->get_reflection_property_value('lang_array'));
$this->assertArrayEmpty($this->getReflectionPropertyValue('lang_array'));
}

/**
* Test that the lang_array is not initialized by default.
*/
public function testInitializedIsFalseByDefault(): void
{
$this->assertFalse($this->get_reflection_property_value('initialized'));
$this->assertFalse($this->getReflectionPropertyValue('initialized'));
}

/**
Expand All @@ -43,11 +43,11 @@ public function testInitializedIsFalseByDefault(): void
*/
public function testInitSetsInitializedTrue(): void
{
$method = $this->get_accessible_reflection_method('init');
$method = $this->getReflectionMethod('init');

$method->invokeArgs($this->class, [ self::LANGUAGE ]);

$this->assertTrue($this->get_reflection_property_value('initialized'));
$this->assertTrue($this->getReflectionPropertyValue('initialized'));
}

/**
Expand All @@ -58,11 +58,11 @@ public function testInitSetsInitializedTrue(): void
*/
public function testInitForNonDefaultLanguageSetsLangArray(): void
{
$method = $this->get_accessible_reflection_method('init');
$method = $this->getReflectionMethod('init');

$method->invokeArgs($this->class, [ self::LANGUAGE ]);

$property = $this->get_reflection_property_value('lang_array');
$property = $this->getReflectionPropertyValue('lang_array');

$this->assertIsArray($property);
$this->assertNotEmpty($property);
Expand All @@ -76,11 +76,11 @@ public function testInitForNonDefaultLanguageSetsLangArray(): void
*/
public function testInitForDefaultLanguageDoesNotSetLangArray(): void
{
$method = $this->get_accessible_reflection_method('init');
$method = $this->getReflectionMethod('init');

$method->invokeArgs($this->class, [ 'en_US' ]);

$this->assertArrayEmpty($this->get_reflection_property_value('lang_array'));
$this->assertArrayEmpty($this->getReflectionPropertyValue('lang_array'));
}

/**
Expand All @@ -91,9 +91,9 @@ public function testInitForDefaultLanguageDoesNotSetLangArray(): void
*/
public function testInitForDefaultLanguageDoesNotRepopulate(): void
{
$property = $this->get_accessible_reflection_property('lang_array');
$property = $this->getReflectionProperty('lang_array');

$method = $this->get_accessible_reflection_method('init');
$method = $this->getReflectionMethod('init');

$method->invokeArgs($this->class, [ self::LANGUAGE ]);

Expand All @@ -115,7 +115,7 @@ public function testInitForDefaultLanguageDoesNotRepopulate(): void
*/
public function testLangWithoutContextReturnsIdentifierWhenLanguageIsDefault(): void
{
$this->set_reflection_property_value('language', 'en_US');
$this->setReflectionPropertyValue('language', 'en_US');

$this->assertEquals('table', $this->class->lang('table'));
}
Expand All @@ -127,7 +127,7 @@ public function testLangWithoutContextReturnsIdentifierWhenLanguageIsDefault():
*/
public function testLangWithContextReturnsIdentifierWhenLanguageIsDefault(): void
{
$this->set_reflection_property_value('language', 'en_US');
$this->setReflectionPropertyValue('language', 'en_US');

$this->assertEquals('table', $this->class->lang('table', 'kitchen'));
}
Expand All @@ -139,7 +139,7 @@ public function testLangWithContextReturnsIdentifierWhenLanguageIsDefault(): voi
*/
public function testNlangSingularWithoutContextReturnsSingularWhenLanguageIsDefault(): void
{
$this->set_reflection_property_value('language', 'en_US');
$this->setReflectionPropertyValue('language', 'en_US');

$this->assertEquals('%d man', $this->class->nlang('%d man', '%d men', 1));
}
Expand All @@ -151,7 +151,7 @@ public function testNlangSingularWithoutContextReturnsSingularWhenLanguageIsDefa
*/
public function testNlangPluralWithoutContextReturnsPluralWhenLanguageIsDefault(): void
{
$this->set_reflection_property_value('language', 'en_US');
$this->setReflectionPropertyValue('language', 'en_US');

$this->assertEquals('%d men', $this->class->nlang('%d man', '%d men', 2));
}
Expand All @@ -163,7 +163,7 @@ public function testNlangPluralWithoutContextReturnsPluralWhenLanguageIsDefault(
*/
public function testNlangSingularWithContextReturnsSingularWhenLanguageIsDefault(): void
{
$this->set_reflection_property_value('language', 'en_US');
$this->setReflectionPropertyValue('language', 'en_US');

$this->assertEquals('%d man', $this->class->nlang('%d man', '%d men', 1, 'people'));
}
Expand All @@ -175,7 +175,7 @@ public function testNlangSingularWithContextReturnsSingularWhenLanguageIsDefault
*/
public function testNlangPluralWithContextReturnsPluralWhenLanguageIsDefault(): void
{
$this->set_reflection_property_value('language', 'en_US');
$this->setReflectionPropertyValue('language', 'en_US');

$this->assertEquals('%d men', $this->class->nlang('%d man', '%d men', 2, 'people'));
}
Expand Down
2 changes: 1 addition & 1 deletion src/Lunr/L10n/Tests/PHPL10nProviderLangTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @covers Lunr\L10n\PHPL10nProvider
*/
class PHPL10nProviderLangTest extends PHPL10nProviderTest
class PHPL10nProviderLangTest extends PHPL10nProviderTestCase
{

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Lunr/L10n/Tests/PHPL10nProviderNlangTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @covers Lunr\L10n\PHPL10nProvider
*/
class PHPL10nProviderNlangTest extends PHPL10nProviderTest
class PHPL10nProviderNlangTest extends PHPL10nProviderTestCase
{

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Lunr\L10n\Tests;

use Lunr\Halo\LunrBaseTest;
use Lunr\Halo\LunrBaseTestCase;
use Lunr\L10n\PHPL10nProvider;
use Psr\Log\LoggerInterface;

Expand All @@ -20,7 +20,7 @@
*
* @covers Lunr\L10n\PHPL10nProvider
*/
abstract class PHPL10nProviderTest extends LunrBaseTest
abstract class PHPL10nProviderTestCase extends LunrBaseTestCase
{

/**
Expand Down

0 comments on commit d1188d5

Please sign in to comment.