Skip to content

Commit

Permalink
Merge pull request #30 from stof/testsuite_deprecations
Browse files Browse the repository at this point in the history
Fix the reporting of deprecations in the testsuite
  • Loading branch information
stof authored Dec 8, 2021
2 parents b29a3da + 97562ee commit cc82e43
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
3 changes: 3 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener"/>
</listeners>
</phpunit>
4 changes: 3 additions & 1 deletion src/Translator/ExposingTranslator.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
namespace Incenteev\TranslationCheckerBundle\Translator;

use Symfony\Bundle\FrameworkBundle\Translation\Translator;
use Symfony\Component\Translation\MessageCatalogueInterface;

/**
* Class extending the translator to expose the catalogue loading.
* @internal
*/
class ExposingTranslator extends Translator
{
public function getCatalogue($locale = null)
public function getCatalogue($locale = null): MessageCatalogueInterface
{
if (null === $locale) {
$locale = $this->getLocale();
Expand Down
10 changes: 5 additions & 5 deletions tests/FixtureApp/TestKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

class TestKernel extends Kernel
{
public function registerBundles()
public function registerBundles(): iterable
{
return array(
new FrameworkBundle(),
new IncenteevTranslationCheckerBundle(),
);
}

public function registerContainerConfiguration(LoaderInterface $loader)
public function registerContainerConfiguration(LoaderInterface $loader): void
{
$loader->load(function (ContainerBuilder $container) {
$container->loadFromExtension('framework', array(
Expand All @@ -30,20 +30,20 @@ public function registerContainerConfiguration(LoaderInterface $loader)
});
}

public function getProjectDir()
public function getProjectDir(): string
{
// Fake implementation so that the old root_dir/Resources/translations and the new project_dir/translations both
// map to the same folder in our fixture app to avoid getting a deprecation warning when running tests with 4.2+
// but keeping compat with running tests on 3.4.
return __DIR__.'/Resources';
}

public function getCacheDir()
public function getCacheDir(): string
{
return sys_get_temp_dir().'/incenteev_translation_checker';
}

public function getLogDir()
public function getLogDir(): string
{
return $this->getCacheDir();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ public function testCompareCommand($locale, $valid)
$this->assertSame($expectedExitCode, $application->run($input, $output));
}

public static function provideComparisonCases()
public static function provideComparisonCases(): iterable
{
return array(
array('fr', true),
array('de', false),
);
}

protected static function getKernelClass()
protected static function getKernelClass(): string
{
return 'Incenteev\TranslationCheckerBundle\Tests\FixtureApp\TestKernel';
}
Expand Down

0 comments on commit cc82e43

Please sign in to comment.