diff --git a/.travis.yml b/.travis.yml index 0401b44..83fdda8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ cache: directories: - $HOME/.composer/cache/files -env: SYMFONY_VERSION='3.3.*' SYMFONY_PHPUNIT_VERSION=5.5 +env: SYMFONY_VERSION='3.3.*' matrix: include: @@ -21,7 +21,6 @@ matrix: - COMPOSER_FLAGS="--prefer-lowest" - SYMFONY_VERSION='2.8.*' - php: 7.1 - env: env: - SYMFONY_VERSION='2.8.*' - php: 7.1 @@ -38,9 +37,10 @@ matrix: - SYMFONY_VERSION='3.4.*@BETA' - php: 7.1 env: - - SYMFONY_VERSION='4.0.*@BETA' - - php: hhvm - dist: trusty + - SYMFONY_VERSION='4.0.*' + - php: 7.2 + env: + - SYMFONY_VERSION='4.1.*' before_install: - phpenv config-rm xdebug.ini || true diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index b966f38..c49733c 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -24,8 +24,13 @@ class Configuration implements ConfigurationInterface */ public function getConfigTreeBuilder() { - $treeBuilder = new TreeBuilder(); - $rootNode = $treeBuilder->root('lunetics_locale'); + $treeBuilder = new TreeBuilder('lunetics_locale'); + + if (method_exists($treeBuilder, 'getRootNode')) { + $rootNode = $treeBuilder->getRootNode(); + } else { + $rootNode = $treeBuilder->root('lunetics_locale'); + } $validStatuscodes = array(300, 301, 302, 303, 307); diff --git a/Tests/Controller/LocaleControllerTest.php b/Tests/Controller/LocaleControllerTest.php index ce0688a..f9f8f82 100644 --- a/Tests/Controller/LocaleControllerTest.php +++ b/Tests/Controller/LocaleControllerTest.php @@ -9,29 +9,34 @@ */ namespace Lunetics\LocaleBundle\Tests\Controller; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Lunetics\LocaleBundle\Controller\LocaleController; -class LocaleControllerTest extends \PHPUnit_Framework_TestCase +class LocaleControllerTest extends TestCase { public function testControllerThrowsException() { $metaValidatorMock = $this->getMetaValidatorMock(false); $metaValidatorMock->expects($this->atLeastOnce()) - ->method('isAllowed') - ->with($this->anything()) - ->will($this->returnCallback(function ($v) { - return $v === 'de'; - })); + ->method('isAllowed') + ->with($this->anything()) + ->will( + $this->returnCallback( + function ($v) { + return $v === 'de'; + } + ) + ); $request = $this->getRequestWithBrowserPreferences(); $request->setLocale('en'); $localeController = new LocaleController($this->getRouterMock(), $metaValidatorMock); - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException('\InvalidArgumentException'); $localeController->switchAction($request); } @@ -97,9 +102,9 @@ private function getRouterMock() { $routerMock = $this->getMockBuilder('Symfony\Component\Routing\RouterInterface')->disableOriginalConstructor()->getMock(); $routerMock->expects($this->any()) - ->method('generate') - ->with($this->equalTo('fallback_route'), $this->anything()) - ->will($this->returnValue('http://fallback_route.com/')); + ->method('generate') + ->with($this->equalTo('fallback_route'), $this->anything()) + ->will($this->returnValue('http://fallback_route.com/')); return $routerMock; } diff --git a/Tests/Cookie/LocaleCookieTest.php b/Tests/Cookie/LocaleCookieTest.php index 0f6f7fd..4fb5ca7 100644 --- a/Tests/Cookie/LocaleCookieTest.php +++ b/Tests/Cookie/LocaleCookieTest.php @@ -10,9 +10,10 @@ namespace Lunetics\LocaleBundle\Tests\DependencyInjection; use Lunetics\LocaleBundle\Cookie\LocaleCookie; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Cookie; -class LocaleCookieTest extends \PHPUnit_Framework_TestCase +class LocaleCookieTest extends TestCase { public function testCookieParamsAreSet() { diff --git a/Tests/DependencyInjection/Compiler/GuesserCompilerPassTest.php b/Tests/DependencyInjection/Compiler/GuesserCompilerPassTest.php index cdbcefe..e9fffc1 100644 --- a/Tests/DependencyInjection/Compiler/GuesserCompilerPassTest.php +++ b/Tests/DependencyInjection/Compiler/GuesserCompilerPassTest.php @@ -10,12 +10,13 @@ namespace Lunetics\LocaleBundle\Tests\DependencyInjection\Compiler; use Lunetics\LocaleBundle\DependencyInjection\Compiler\GuesserCompilerPass; +use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; /** * @author Kevin Archer */ -class GuesserCompilerPassTest extends \PHPUnit_Framework_TestCase +class GuesserCompilerPassTest extends TestCase { public function testProcess() { diff --git a/Tests/DependencyInjection/Compiler/RemoveSessionPassTest.php b/Tests/DependencyInjection/Compiler/RemoveSessionPassTest.php index 6339414..cc433c1 100644 --- a/Tests/DependencyInjection/Compiler/RemoveSessionPassTest.php +++ b/Tests/DependencyInjection/Compiler/RemoveSessionPassTest.php @@ -9,26 +9,28 @@ */ namespace Lunetics\LocaleBundle\Tests\DependencyInjection\Compiler; -use Lunetics\LocaleBundle\DependencyInjection\Compiler\GuesserCompilerPass; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Lunetics\LocaleBundle\DependencyInjection\Compiler\RemoveSessionPass; +use PHPUnit\Framework\TestCase; +use Symfony\Component\DependencyInjection\ContainerBuilder; /** * @author Asmir Mustafic */ -class RemoveSessionPassTest extends \PHPUnit_Framework_TestCase +class RemoveSessionPassTest extends TestCase { /** - * * @return \Symfony\Component\DependencyInjection\ContainerBuilder */ - private function getContainer(){ + private function getContainer() + { $container = new ContainerBuilder(); $container->register('lunetics_locale.session_guesser'); $container->register('lunetics_locale.locale_session'); + return $container; } + public function testSessionPresent() { $container = $this->getContainer(); @@ -39,8 +41,8 @@ public function testSessionPresent() $this->assertTrue($container->hasDefinition('lunetics_locale.session_guesser')); $this->assertTrue($container->hasDefinition('lunetics_locale.locale_session')); - } + public function testSessioAbsent() { $container = $this->getContainer(); @@ -49,7 +51,6 @@ public function testSessioAbsent() $this->assertFalse($container->hasDefinition('lunetics_locale.session_guesser')); $this->assertFalse($container->hasDefinition('lunetics_locale.locale_session')); - } protected function process(ContainerBuilder $container) diff --git a/Tests/DependencyInjection/LuneticsLocaleExtensionTest.php b/Tests/DependencyInjection/LuneticsLocaleExtensionTest.php index 87b4a49..4a447e4 100644 --- a/Tests/DependencyInjection/LuneticsLocaleExtensionTest.php +++ b/Tests/DependencyInjection/LuneticsLocaleExtensionTest.php @@ -9,16 +9,15 @@ */ namespace Lunetics\LocaleBundle\Tests\DependencyInjection; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Config\Resource\ResourceInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Lunetics\LocaleBundle\DependencyInjection\LuneticsLocaleExtension; +use PHPUnit\Framework\TestCase; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Yaml\Parser; /** * @author Kevin Archer */ -class LuneticsLocaleExtensionTest extends \PHPUnit_Framework_TestCase +class LuneticsLocaleExtensionTest extends TestCase { /** * @dataProvider getFullConfig @@ -87,7 +86,6 @@ public function testBindParameters() public function getFullConfig() { - $parser = new Parser(); $data = array(); @@ -114,7 +112,7 @@ public function getFullConfig() dutchversion.be: nl_BE dutch-version.be: nl_BE EOF; - $data[]=array($parser->parse($yaml), false); + $data[] = array($parser->parse($yaml), false); $yaml = <<parse($yaml), true); + $data[] = array($parser->parse($yaml), true); return $data; } diff --git a/Tests/Event/FilterLocaleSwitchEventTest.php b/Tests/Event/FilterLocaleSwitchEventTest.php index 152547a..e73eefe 100644 --- a/Tests/Event/FilterLocaleSwitchEventTest.php +++ b/Tests/Event/FilterLocaleSwitchEventTest.php @@ -11,9 +11,10 @@ namespace Lunetics\LocaleBundle\Tests\Event; use Lunetics\LocaleBundle\Event\FilterLocaleSwitchEvent; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; -class FilterLocaleSwitchEventTest extends \PHPUnit_Framework_TestCase +class FilterLocaleSwitchEventTest extends TestCase { public function testFilterLocaleSwitchEvent() { @@ -29,7 +30,7 @@ public function testFilterLocaleSwitchEvent() */ public function testThrowsInvalidTypeException($locale) { - $this->setExpectedException('\InvalidArgumentException'); + $this->expectException('\InvalidArgumentException'); new FilterLocaleSwitchEvent(Request::create('/'), $locale); } diff --git a/Tests/EventListener/LocaleListenerTest.php b/Tests/EventListener/LocaleListenerTest.php index 8e5e965..979165c 100644 --- a/Tests/EventListener/LocaleListenerTest.php +++ b/Tests/EventListener/LocaleListenerTest.php @@ -10,7 +10,7 @@ namespace Lunetics\LocaleBundle\Tests\EventListener; -use Lunetics\LocaleBundle\LocaleGuesser\LocaleGuesserInterface; +use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Request; @@ -18,22 +18,22 @@ use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\HttpKernel\KernelEvents; use Lunetics\LocaleBundle\EventListener\LocaleListener; +use Lunetics\LocaleBundle\LocaleBundleEvents; use Lunetics\LocaleBundle\LocaleGuesser\LocaleGuesserManager; use Lunetics\LocaleBundle\LocaleGuesser\RouterLocaleGuesser; use Lunetics\LocaleBundle\LocaleGuesser\BrowserLocaleGuesser; use Lunetics\LocaleBundle\LocaleGuesser\CookieLocaleGuesser; use Lunetics\LocaleBundle\LocaleGuesser\QueryLocaleGuesser; -use Lunetics\LocaleBundle\Validator\MetaValidator; -use Lunetics\LocaleBundle\LocaleBundleEvents; -use Symfony\Component\HttpKernel\KernelEvents; -use Lunetics\LocaleBundle\Matcher\DefaultBestLocaleMatcher; use Lunetics\LocaleBundle\LocaleInformation\AllowedLocalesProvider; +use Lunetics\LocaleBundle\Matcher\DefaultBestLocaleMatcher; +use Lunetics\LocaleBundle\Validator\MetaValidator; -class LocaleListenerTest extends \PHPUnit_Framework_TestCase +class LocaleListenerTest extends TestCase { public function testDefaultLocaleWithoutParams() { @@ -45,6 +45,7 @@ public function testDefaultLocaleWithoutParams() $listener->onKernelRequest($event); $this->assertEquals('fr', $request->getLocale()); } + public function getTestDataForBestLocaleMatcher() { return array( @@ -227,7 +228,8 @@ public function testOnLocaleDetectedSetVaryHeader() $listener->onLocaleDetectedSetVaryHeader($filterResponseEvent); } - public function testOnLocaleDetectedDisabledVaryHeader () { + public function testOnLocaleDetectedDisabledVaryHeader() + { $listener = $this->getListener(); $listener->setDisableVaryHeader(true); @@ -360,14 +362,6 @@ private function getMockGuesserManager() return $this->createMock(LocaleGuesserManager::class); } - /** - * @return LocaleGuesserInterface - */ - private function getMockGuesser() - { - return $this->createMock(LocaleGuesserInterface::class); - } - /** * @return MetaValidator */ @@ -408,11 +402,6 @@ private function getEmptyRequest() return $request; } - private function getMockRequest() - { - return $this->createMock(Request::class); - } - private function getMockResponse() { return $this->createMock(Response::class); diff --git a/Tests/EventListener/LocaleUpdateTest.php b/Tests/EventListener/LocaleUpdateTest.php index f8a151e..8d7bec4 100644 --- a/Tests/EventListener/LocaleUpdateTest.php +++ b/Tests/EventListener/LocaleUpdateTest.php @@ -10,23 +10,24 @@ namespace Lunetics\LocaleBundle\Tests\EventListener; -use Lunetics\LocaleBundle\LocaleBundleEvents; +use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; +use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; +use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; -use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpFoundation\Response; +use Lunetics\LocaleBundle\Cookie\LocaleCookie; use Lunetics\LocaleBundle\Event\FilterLocaleSwitchEvent; use Lunetics\LocaleBundle\EventListener\LocaleUpdateListener; +use Lunetics\LocaleBundle\LocaleBundleEvents; use Lunetics\LocaleBundle\Session\LocaleSession; -use Lunetics\LocaleBundle\Cookie\LocaleCookie; -class LocaleUpdateTest extends \PHPUnit_Framework_TestCase +class LocaleUpdateTest extends TestCase { /** * @var EventDispatcher diff --git a/Tests/Form/Extension/ChoiceList/LocaleChoiceListTest.php b/Tests/Form/Extension/ChoiceList/LocaleChoiceListTest.php index 507fedf..1ce6fd0 100644 --- a/Tests/Form/Extension/ChoiceList/LocaleChoiceListTest.php +++ b/Tests/Form/Extension/ChoiceList/LocaleChoiceListTest.php @@ -10,13 +10,14 @@ namespace Lunetics\LocaleBundle\Tests\Form\Extension\ChoiceList; use Lunetics\LocaleBundle\Form\Extension\ChoiceList\LocaleChoiceList; +use PHPUnit\Framework\TestCase; /** * Test for the LocaleInformation * * @author Matthias Breddin */ -class LocaleChoiceListTest extends \PHPUnit_Framework_TestCase +class LocaleChoiceListTest extends TestCase { public function testDefaultChoiceList() diff --git a/Tests/Form/Extension/Type/LocaleTypeTest.php b/Tests/Form/Extension/Type/LocaleTypeTest.php index 45f9fdf..5285efb 100644 --- a/Tests/Form/Extension/Type/LocaleTypeTest.php +++ b/Tests/Form/Extension/Type/LocaleTypeTest.php @@ -11,12 +11,13 @@ use Lunetics\LocaleBundle\Form\Extension\ChoiceList\LocaleChoiceList; use Lunetics\LocaleBundle\Form\Extension\Type\LocaleType; +use PHPUnit\Framework\TestCase; use Symfony\Component\OptionsResolver\OptionsResolver; /** * @author Kevin Archer */ -class LocaleTypeTest extends \PHPUnit_Framework_TestCase +class LocaleTypeTest extends TestCase { public function testConfigureOptions() { diff --git a/Tests/LocaleGuesser/BrowserLocaleGuesserTest.php b/Tests/LocaleGuesser/BrowserLocaleGuesserTest.php index 00f65ee..43e127a 100644 --- a/Tests/LocaleGuesser/BrowserLocaleGuesserTest.php +++ b/Tests/LocaleGuesser/BrowserLocaleGuesserTest.php @@ -11,9 +11,10 @@ use Lunetics\LocaleBundle\LocaleGuesser\BrowserLocaleGuesser; use Lunetics\LocaleBundle\LocaleGuesser\LocaleGuesserInterface; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; -class BrowserLocaleGuesserTest extends \PHPUnit_Framework_TestCase +class BrowserLocaleGuesserTest extends TestCase { public function testGuesserExtendsInterface() { diff --git a/Tests/LocaleGuesser/CookieLocaleGuesserTest.php b/Tests/LocaleGuesser/CookieLocaleGuesserTest.php index 053d36e..24f0957 100644 --- a/Tests/LocaleGuesser/CookieLocaleGuesserTest.php +++ b/Tests/LocaleGuesser/CookieLocaleGuesserTest.php @@ -10,9 +10,10 @@ namespace Lunetics\LocaleBundle\Tests\LocaleGuesser; use Lunetics\LocaleBundle\LocaleGuesser\CookieLocaleGuesser; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; -class CookieLocaleGuesserTest extends \PHPUnit_Framework_TestCase +class CookieLocaleGuesserTest extends TestCase { public function testLocaleIsRetrievedFromCookieIfSet() diff --git a/Tests/LocaleGuesser/DomainLocaleGuesserTest.php b/Tests/LocaleGuesser/DomainLocaleGuesserTest.php index 5649c19..4a828bb 100644 --- a/Tests/LocaleGuesser/DomainLocaleGuesserTest.php +++ b/Tests/LocaleGuesser/DomainLocaleGuesserTest.php @@ -12,12 +12,13 @@ use Lunetics\LocaleBundle\LocaleGuesser\DomainLocaleGuesser; use Lunetics\LocaleBundle\LocaleInformation\DomainLocaleMap; use Lunetics\LocaleBundle\Validator\MetaValidator; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; /** * @author Jachim Coudenys */ -class DomainLocaleGuesserTest extends \PHPUnit_Framework_TestCase +class DomainLocaleGuesserTest extends TestCase { /** * @dataProvider dataDomains diff --git a/Tests/LocaleGuesser/LocaleGuesserManagerTest.php b/Tests/LocaleGuesser/LocaleGuesserManagerTest.php index 48a5ea1..73cd3c0 100644 --- a/Tests/LocaleGuesser/LocaleGuesserManagerTest.php +++ b/Tests/LocaleGuesser/LocaleGuesserManagerTest.php @@ -9,6 +9,7 @@ */ namespace Lunetics\LocaleBundle\Tests\LocaleGuesser; +use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; use Symfony\Component\HttpFoundation\Request; @@ -18,13 +19,13 @@ use Lunetics\LocaleBundle\LocaleGuesser\LocaleGuesserInterface; use Lunetics\LocaleBundle\Validator\MetaValidator; -class LocaleGuesserManagerTest extends \PHPUnit_Framework_TestCase +class LocaleGuesserManagerTest extends TestCase { public function testLocaleGuessingInvalidGuesser() { - $this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException'); $guesserManager = new LocaleGuesserManager(array(0 => 'foo')); $guesserManager->addGuesser($this->getGuesserMock(), 'bar'); + $this->expectException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException'); $guesserManager->runLocaleGuessing($this->getRequestWithoutLocaleQuery()); } diff --git a/Tests/LocaleGuesser/QueryLocaleGuesserTest.php b/Tests/LocaleGuesser/QueryLocaleGuesserTest.php index 6cbf4db..27c893d 100644 --- a/Tests/LocaleGuesser/QueryLocaleGuesserTest.php +++ b/Tests/LocaleGuesser/QueryLocaleGuesserTest.php @@ -11,9 +11,10 @@ use Lunetics\LocaleBundle\LocaleGuesser\QueryLocaleGuesser; use Lunetics\LocaleBundle\LocaleGuesser\LocaleGuesserInterface; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; -class QueryLocaleGuesserTest extends \PHPUnit_Framework_TestCase +class QueryLocaleGuesserTest extends TestCase { public function testGuesserExtendsInterface() { diff --git a/Tests/LocaleGuesser/RouterLocaleGuesserTest.php b/Tests/LocaleGuesser/RouterLocaleGuesserTest.php index 2d045d4..780f3a7 100644 --- a/Tests/LocaleGuesser/RouterLocaleGuesserTest.php +++ b/Tests/LocaleGuesser/RouterLocaleGuesserTest.php @@ -11,9 +11,10 @@ use Lunetics\LocaleBundle\LocaleGuesser\RouterLocaleGuesser; use Lunetics\LocaleBundle\LocaleGuesser\LocaleGuesserInterface; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; -class RouterLocaleGuesserTest extends \PHPUnit_Framework_TestCase +class RouterLocaleGuesserTest extends TestCase { public function testGuesserExtendsInterface() { diff --git a/Tests/LocaleGuesser/SessionLocaleGuesserTest.php b/Tests/LocaleGuesser/SessionLocaleGuesserTest.php index 1a62a74..244c05b 100644 --- a/Tests/LocaleGuesser/SessionLocaleGuesserTest.php +++ b/Tests/LocaleGuesser/SessionLocaleGuesserTest.php @@ -11,11 +11,12 @@ use Lunetics\LocaleBundle\LocaleGuesser\SessionLocaleGuesser; use Lunetics\LocaleBundle\LocaleGuesser\LocaleGuesserInterface; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\HttpFoundation\Session\Session; -class SessionLocaleGuesserTest extends \PHPUnit_Framework_TestCase +class SessionLocaleGuesserTest extends TestCase { public function testGuesserExtendsInterface() { diff --git a/Tests/LocaleGuesser/SubdomainLocaleGuesserTest.php b/Tests/LocaleGuesser/SubdomainLocaleGuesserTest.php index 45f0354..09c3559 100644 --- a/Tests/LocaleGuesser/SubdomainLocaleGuesserTest.php +++ b/Tests/LocaleGuesser/SubdomainLocaleGuesserTest.php @@ -12,12 +12,13 @@ use Lunetics\LocaleBundle\LocaleGuesser\SubdomainLocaleGuesser; use Lunetics\LocaleBundle\Validator\MetaValidator; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; /** * @author Kevin Archer */ -class SubdomainLocaleGuesserTest extends \PHPUnit_Framework_TestCase +class SubdomainLocaleGuesserTest extends TestCase { /** * @dataProvider dataDomains diff --git a/Tests/LocaleGuesser/TopleveldomainLocaleGuesserTest.php b/Tests/LocaleGuesser/TopleveldomainLocaleGuesserTest.php index 6869963..d511088 100644 --- a/Tests/LocaleGuesser/TopleveldomainLocaleGuesserTest.php +++ b/Tests/LocaleGuesser/TopleveldomainLocaleGuesserTest.php @@ -12,17 +12,19 @@ use Lunetics\LocaleBundle\LocaleGuesser\TopleveldomainLocaleGuesser; use Lunetics\LocaleBundle\LocaleInformation\TopleveldomainLocaleMap; use Lunetics\LocaleBundle\Validator\MetaValidator; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; /** * @author Ivo Bathke */ -class TopleveldomainLocaleGuesserTest extends \PHPUnit_Framework_TestCase +class TopleveldomainLocaleGuesserTest extends TestCase { /** * @dataProvider dataDomains * * @param bool $expected + * @param string $expectedLocale * @param string $host * @param bool $allowed * @param string $mappedLocale diff --git a/Tests/LocaleInformation/DomainLocaleMapTest.php b/Tests/LocaleInformation/DomainLocaleMapTest.php index 6c25a59..4c644fe 100644 --- a/Tests/LocaleInformation/DomainLocaleMapTest.php +++ b/Tests/LocaleInformation/DomainLocaleMapTest.php @@ -10,11 +10,12 @@ namespace Lunetics\LocaleBundle\Tests\LocaleInformation; use Lunetics\LocaleBundle\LocaleInformation\DomainLocaleMap; +use PHPUnit\Framework\TestCase; /** * @author Ivo Bathke */ -class DomainLocaleMapTest extends \PHPUnit_Framework_TestCase +class DomainLocaleMapTest extends TestCase { public function testGetLocale() { @@ -33,4 +34,4 @@ public function testGetLocale() $this->assertEquals(false, $domainLocaleMap->getLocale('unknown.be')); $this->assertEquals('fr_BE', $domainLocaleMap->getLocale('frenchversion.be')); } -} +} diff --git a/Tests/LocaleInformation/TopleveldomainLocaleMapTest.php b/Tests/LocaleInformation/TopleveldomainLocaleMapTest.php index 87fad9a..2e92973 100644 --- a/Tests/LocaleInformation/TopleveldomainLocaleMapTest.php +++ b/Tests/LocaleInformation/TopleveldomainLocaleMapTest.php @@ -10,11 +10,12 @@ namespace Lunetics\LocaleBundle\Tests\LocaleInformation; use Lunetics\LocaleBundle\LocaleInformation\TopleveldomainLocaleMap; +use PHPUnit\Framework\TestCase; /** * @author Ivo Bathke */ -class TopleveldomainLocaleMapTest extends \PHPUnit_Framework_TestCase +class TopleveldomainLocaleMapTest extends TestCase { public function testGetLocale() { @@ -31,4 +32,4 @@ public function testGetLocale() $this->assertEquals(false, $tldLocaleMap->getLocale('org')); $this->assertEquals('fr_BE', $tldLocaleMap->getLocale('be')); } -} \ No newline at end of file +} diff --git a/Tests/LuneticsLocaleBundleTest.php b/Tests/LuneticsLocaleBundleTest.php index 34f5da3..9b5a501 100644 --- a/Tests/LuneticsLocaleBundleTest.php +++ b/Tests/LuneticsLocaleBundleTest.php @@ -12,12 +12,13 @@ use Lunetics\LocaleBundle\DependencyInjection\Compiler\GuesserCompilerPass; use Lunetics\LocaleBundle\DependencyInjection\Compiler\RouterResourcePass; use Lunetics\LocaleBundle\LuneticsLocaleBundle; +use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; /** * @author Kevin Archer */ -class LuneticsLocaleBundleTest extends \PHPUnit_Framework_TestCase +class LuneticsLocaleBundleTest extends TestCase { public function testBuild() { diff --git a/Tests/Matcher/BestLocaleMatcherTest.php b/Tests/Matcher/BestLocaleMatcherTest.php index 469160d..7668e0b 100644 --- a/Tests/Matcher/BestLocaleMatcherTest.php +++ b/Tests/Matcher/BestLocaleMatcherTest.php @@ -12,14 +12,19 @@ use Lunetics\LocaleBundle\Matcher\DefaultBestLocaleMatcher; use Lunetics\LocaleBundle\LocaleInformation\AllowedLocalesProvider; +use PHPUnit\Framework\TestCase; /** * @author Asmir Mustafic */ -class BestLocaleMatcherTest extends \PHPUnit_Framework_TestCase +class BestLocaleMatcherTest extends TestCase { - /** + /** * @dataProvider getTestDataForBestLocaleMatcher + * + * @param string $locale + * @param array $allowed + * @param string|bool $expected */ public function testMatch($locale, $allowed, $expected) { diff --git a/Tests/Session/LocaleSessionTest.php b/Tests/Session/LocaleSessionTest.php index fc9a68c..852cc92 100644 --- a/Tests/Session/LocaleSessionTest.php +++ b/Tests/Session/LocaleSessionTest.php @@ -10,12 +10,13 @@ namespace Lunetics\LocaleBundle\Tests\LocaleInformation; use Lunetics\LocaleBundle\Session\LocaleSession; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Session\Session; /** * @author Kevin Archer */ -class LocaleSessionTest extends \PHPUnit_Framework_TestCase +class LocaleSessionTest extends TestCase { public function testHasLocaleChanged() { @@ -77,4 +78,4 @@ public function getMockSession() { return $this->createMock(Session::class); } -} \ No newline at end of file +} diff --git a/Tests/Switcher/TargetInformationBuilderTest.php b/Tests/Switcher/TargetInformationBuilderTest.php index 93336ca..02d74a1 100644 --- a/Tests/Switcher/TargetInformationBuilderTest.php +++ b/Tests/Switcher/TargetInformationBuilderTest.php @@ -4,10 +4,11 @@ use Lunetics\LocaleBundle\LocaleInformation\AllowedLocalesProvider; use Lunetics\LocaleBundle\Switcher\TargetInformationBuilder; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; -class TargetInformationBuilderTest extends \PHPUnit_Framework_TestCase +class TargetInformationBuilderTest extends TestCase { public function locales() { @@ -130,7 +131,6 @@ public function testInformationBuilder($route, $locale, $allowedLocales) /** * @dataProvider locales - * */ public function testInformationBuilderWithParams($route, $locale, $allowedLocales) { @@ -182,7 +182,6 @@ public function testGenerateNotCalledIfNoRoute() /** * @param string $route * @param string $locale - * * @param array $attributes * * @return RequestStack diff --git a/Tests/Templating/Helper/LocaleSwitchHelperTest.php b/Tests/Templating/Helper/LocaleSwitchHelperTest.php index df7abad..ad0819b 100644 --- a/Tests/Templating/Helper/LocaleSwitchHelperTest.php +++ b/Tests/Templating/Helper/LocaleSwitchHelperTest.php @@ -10,12 +10,13 @@ namespace Lunetics\LocaleBundle\Tests\Templating\Helper; use Lunetics\LocaleBundle\Templating\Helper\LocaleSwitchHelper; +use PHPUnit\Framework\TestCase; use Symfony\Component\Templating\EngineInterface; /** * @author Kevin Archer */ -class LocaleSwitchHelperTest extends \PHPUnit_Framework_TestCase +class LocaleSwitchHelperTest extends TestCase { public function testRenderSwitch() { diff --git a/Tests/Twig/Extension/LocaleSwitcherExtensionTest.php b/Tests/Twig/Extension/LocaleSwitcherExtensionTest.php index 8f14284..ed76cc1 100644 --- a/Tests/Twig/Extension/LocaleSwitcherExtensionTest.php +++ b/Tests/Twig/Extension/LocaleSwitcherExtensionTest.php @@ -11,10 +11,10 @@ namespace Lunetics\LocaleBundle\Tests\Twig\Extension; -use Lunetics\LocaleBundle\LocaleInformation\AllowedLocalesProvider; use Lunetics\LocaleBundle\Switcher\TargetInformationBuilder; use Lunetics\LocaleBundle\Templating\Helper\LocaleSwitchHelper; use Lunetics\LocaleBundle\Twig\Extension\LocaleSwitcherExtension; +use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; /** @@ -22,7 +22,7 @@ * * @author Kevin Archer */ -class LocaleSwitcherExtensionTest extends \PHPUnit_Framework_TestCase +class LocaleSwitcherExtensionTest extends TestCase { private $targetInformationBuildMock; private $localeSwitcherHelperMock; diff --git a/Tests/Validator/BaseMetaValidator.php b/Tests/Validator/BaseMetaValidator.php index d58e098..c2fbd9b 100644 --- a/Tests/Validator/BaseMetaValidator.php +++ b/Tests/Validator/BaseMetaValidator.php @@ -14,8 +14,9 @@ use Lunetics\LocaleBundle\Validator\LocaleAllowedValidator; use Lunetics\LocaleBundle\Validator\MetaValidator; -use Symfony\Component\Validator\Validation; +use PHPUnit\Framework\TestCase; use Symfony\Component\Config\FileLocator; +use Symfony\Component\Validator\Validation; use Symfony\Component\Yaml\Parser as YamlParser; /** @@ -23,7 +24,7 @@ * * @author Matthias Breddin */ -class BaseMetaValidator extends \PHPUnit_Framework_TestCase +class BaseMetaValidator extends TestCase { protected $context; protected static $iso639; @@ -132,7 +133,6 @@ public function getInstance(Constraint $constraint) $this->validators[$className] = $this->localeAllowedValidator; } - return $this->validators[$className]; } }