From 469707e05ddf5e19c11ed2863f9ba5362d862471 Mon Sep 17 00:00:00 2001 From: core23 Date: Sun, 3 Dec 2023 15:21:00 +0100 Subject: [PATCH] Fix CS --- phpstan-baseline.neon | 5 +++ psalm-baseline.xml | 5 ++- src/Exception/SitemapNotFoundException.php | 4 +- src/Test/AbstractSitemapServiceTestCase.php | 4 +- tests/Action/SitemapXMLActionTest.php | 4 +- tests/Action/SitemapXMLActionWebTest.php | 10 ++--- tests/App/Sitemap/DemoSitemap.php | 4 +- tests/Block/Breadcrumb/BreadcrumbTest.php | 4 +- ...readcrumbBlockServicesCompilerPassTest.php | 2 +- .../Compiler/ServiceCompilerPassTest.php | 12 +++--- .../Compiler/SitemapCompilerPassTest.php | 20 ++++----- .../DependencyInjection/ConfigurationTest.php | 8 ++-- .../NucleosSeoExtensionTest.php | 4 +- tests/Fixtures/InvalidArgumentException.php | 4 +- tests/Fixtures/SitemapDefinitionStub.php | 4 +- tests/Generator/SitemapGeneratorTest.php | 20 ++++----- tests/NucleosSeoBundleTest.php | 4 +- tests/Seo/SeoPageTest.php | 42 +++++++++---------- .../Definition/DefinitionManagerTest.php | 4 +- .../Definition/SitemapDefintionTest.php | 18 ++++---- tests/Sitemap/SitemapServiceManagerTest.php | 10 ++--- tests/Twig/Extension/SeoExtensionTest.php | 42 +++++++++---------- 22 files changed, 117 insertions(+), 117 deletions(-) diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 84fe83f..fdda88b 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -25,6 +25,11 @@ parameters: count: 1 path: tests/App/AppKernel.php + - + message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\TestCase\\:\\:createStub\\(\\)\\.$#" + count: 6 + path: tests/Block/Breadcrumb/BreadcrumbTest.php + - message: "#^Parameter \\#1 \\$services of class Nucleos\\\\SeoBundle\\\\Sitemap\\\\SitemapServiceManager constructor expects array\\, array\\ given\\.$#" count: 1 diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 01e73fd..dbed316 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + children @@ -61,5 +61,8 @@ $data $data + + urls[$index]]]> + diff --git a/src/Exception/SitemapNotFoundException.php b/src/Exception/SitemapNotFoundException.php index 90f2cab..3bafd65 100755 --- a/src/Exception/SitemapNotFoundException.php +++ b/src/Exception/SitemapNotFoundException.php @@ -13,6 +13,4 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -final class SitemapNotFoundException extends NotFoundHttpException -{ -} +final class SitemapNotFoundException extends NotFoundHttpException {} diff --git a/src/Test/AbstractSitemapServiceTestCase.php b/src/Test/AbstractSitemapServiceTestCase.php index 9cf4420..1411e75 100644 --- a/src/Test/AbstractSitemapServiceTestCase.php +++ b/src/Test/AbstractSitemapServiceTestCase.php @@ -59,7 +59,7 @@ final protected function process(SitemapDefinitionInterface $sitemap): void $result = $this->service->execute($sitemap); $count = \count($this->urls); - static::assertCount($count, $result); + self::assertCount($count, $result); if (0 === $count) { return; @@ -91,7 +91,7 @@ final protected function assertSitemap(string $location, int $priority, string $ final protected function assertSitemapCount(int $count): void { - static::assertCount($count, $this->urls); + self::assertCount($count, $this->urls); } private function getUrlIndex(UrlInterface $url): int diff --git a/tests/Action/SitemapXMLActionTest.php b/tests/Action/SitemapXMLActionTest.php index 733bf15..cd8bb44 100644 --- a/tests/Action/SitemapXMLActionTest.php +++ b/tests/Action/SitemapXMLActionTest.php @@ -28,7 +28,7 @@ public function testExecute(): void $response = $action(); - static::assertSame('text/xml', $response->headers->get('Content-Type')); - static::assertSame('', $response->getContent()); + self::assertSame('text/xml', $response->headers->get('Content-Type')); + self::assertSame('', $response->getContent()); } } diff --git a/tests/Action/SitemapXMLActionWebTest.php b/tests/Action/SitemapXMLActionWebTest.php index 711b179..1aba24e 100644 --- a/tests/Action/SitemapXMLActionWebTest.php +++ b/tests/Action/SitemapXMLActionWebTest.php @@ -17,15 +17,15 @@ final class SitemapXMLActionWebTest extends WebTestCase { public function testSitemapXml(): void { - $client = static::createClient(); + $client = self::createClient(); $client->request('GET', '/sitemap.xml'); $response = $client->getResponse(); - static::assertSame(200, $client->getResponse()->getStatusCode()); - static::assertResponseIsSuccessful(); - static::assertSame('text/xml; charset=UTF-8', $response->headers->get('Content-Type')); - static::assertSame('example.com/foo50/bar75', $response->getContent()); + self::assertSame(200, $client->getResponse()->getStatusCode()); + self::assertResponseIsSuccessful(); + self::assertSame('text/xml; charset=UTF-8', $response->headers->get('Content-Type')); + self::assertSame('example.com/foo50/bar75', $response->getContent()); } } diff --git a/tests/App/Sitemap/DemoSitemap.php b/tests/App/Sitemap/DemoSitemap.php index 5a53a37..ca894bc 100644 --- a/tests/App/Sitemap/DemoSitemap.php +++ b/tests/App/Sitemap/DemoSitemap.php @@ -16,9 +16,7 @@ final class DemoSitemap implements SitemapServiceInterface { - public function configureSettings(OptionsResolver $resolver): void - { - } + public function configureSettings(OptionsResolver $resolver): void {} public function execute(SitemapDefinitionInterface $sitemap): array { diff --git a/tests/Block/Breadcrumb/BreadcrumbTest.php b/tests/Block/Breadcrumb/BreadcrumbTest.php index 6b5a34d..301675d 100644 --- a/tests/Block/Breadcrumb/BreadcrumbTest.php +++ b/tests/Block/Breadcrumb/BreadcrumbTest.php @@ -40,7 +40,7 @@ public function testBlockService(): void $this->createStub(FactoryInterface::class) ); - static::assertTrue($blockService->handleContext('test')); + self::assertTrue($blockService->handleContext('test')); } public function testBlockExectute(): void @@ -53,7 +53,7 @@ public function testBlockExectute(): void ); $menu = $this->createStub(ItemInterface::class); - $menuFactory->expects(static::once())->method('createItem')->with('breadcrumb') + $menuFactory->expects(self::once())->method('createItem')->with('breadcrumb') ->willReturn($menu) ; diff --git a/tests/DependencyInjection/Compiler/BreadcrumbBlockServicesCompilerPassTest.php b/tests/DependencyInjection/Compiler/BreadcrumbBlockServicesCompilerPassTest.php index 19843a7..e285498 100644 --- a/tests/DependencyInjection/Compiler/BreadcrumbBlockServicesCompilerPassTest.php +++ b/tests/DependencyInjection/Compiler/BreadcrumbBlockServicesCompilerPassTest.php @@ -118,6 +118,6 @@ private function process(): void */ private function assertServiceOrder(array $services): void { - static::assertSame($services, $this->getCalledServices()); + self::assertSame($services, $this->getCalledServices()); } } diff --git a/tests/DependencyInjection/Compiler/ServiceCompilerPassTest.php b/tests/DependencyInjection/Compiler/ServiceCompilerPassTest.php index 52d68eb..060d07a 100644 --- a/tests/DependencyInjection/Compiler/ServiceCompilerPassTest.php +++ b/tests/DependencyInjection/Compiler/ServiceCompilerPassTest.php @@ -38,11 +38,11 @@ public function testServicesExistsAndCanBeOverridden(): void (new ServiceCompilerPass())->process($container); - static::assertTrue($container->has('nucleos_seo.page')); - static::assertTrue($container->has(SeoPageInterface::class)); - static::assertSame($container->get('nucleos_seo.page'), $container->get(SeoPageInterface::class)); + self::assertTrue($container->has('nucleos_seo.page')); + self::assertTrue($container->has(SeoPageInterface::class)); + self::assertSame($container->get('nucleos_seo.page'), $container->get(SeoPageInterface::class)); - static::assertInstanceOf(SeoPage::class, $container->get(SeoPageInterface::class)); + self::assertInstanceOf(SeoPage::class, $container->get(SeoPageInterface::class)); } public function testGlobalTitle(): void @@ -69,7 +69,7 @@ public function testGlobalTitle(): void \assert($page instanceof SeoPageInterface); - static::assertSame('Project name', $page->getOriginalTitle()); - static::assertSame('Prefix Project name Suffix', $page->getTitle()); + self::assertSame('Project name', $page->getOriginalTitle()); + self::assertSame('Prefix Project name Suffix', $page->getTitle()); } } diff --git a/tests/DependencyInjection/Compiler/SitemapCompilerPassTest.php b/tests/DependencyInjection/Compiler/SitemapCompilerPassTest.php index 4fd6bb3..9e49333 100644 --- a/tests/DependencyInjection/Compiler/SitemapCompilerPassTest.php +++ b/tests/DependencyInjection/Compiler/SitemapCompilerPassTest.php @@ -53,13 +53,13 @@ protected function setUp(): void public function testProcess(): void { - $this->serviceManager->expects(static::once())->method('addMethodCall') - ->with('addSitemap', static::callback(static function (array $args): bool { + $this->serviceManager->expects(self::once())->method('addMethodCall') + ->with('addSitemap', self::callback(static function (array $args): bool { return 'acme.sitemap' === $args[0] && $args[1] instanceof Reference; })) ; - $this->definitionManager->expects(static::once())->method('addMethodCall')->with('addDefinition', [ + $this->definitionManager->expects(self::once())->method('addMethodCall')->with('addDefinition', [ 'acme.sitemap', ]); @@ -72,9 +72,9 @@ public function testProcess(): void $compiler = new SitemapCompilerPass(); $compiler->process($this->container); - static::assertTrue($sitemapDefinition->isPublic()); + self::assertTrue($sitemapDefinition->isPublic()); - $this->definitionManager->expects(static::never())->method('addMethodCall'); + $this->definitionManager->expects(self::never())->method('addMethodCall'); } public function testProcessWithNoServices(): void @@ -84,14 +84,14 @@ public function testProcessWithNoServices(): void $compiler = new SitemapCompilerPass(); $compiler->process($this->container); - static::assertSame([], $this->container->getParameter('nucleos_seo.sitemap.static_urls')); + self::assertSame([], $this->container->getParameter('nucleos_seo.sitemap.static_urls')); - $this->definitionManager->expects(static::never())->method('addMethodCall'); + $this->definitionManager->expects(self::never())->method('addMethodCall'); } public function testProcessWithStaticUrls(): void { - $this->definitionManager->expects(static::once())->method('addMethodCall')->with('addDefinition', [ + $this->definitionManager->expects(self::once())->method('addMethodCall')->with('addDefinition', [ StaticSitemapService::class, [ [ @@ -123,7 +123,7 @@ public function testProcessWithEmptyGroups(): void $compiler = new SitemapCompilerPass(); $compiler->process($this->container); - $this->serviceManager->expects(static::never())->method('addMethodCall'); - $this->definitionManager->expects(static::never())->method('addMethodCall'); + $this->serviceManager->expects(self::never())->method('addMethodCall'); + $this->definitionManager->expects(self::never())->method('addMethodCall'); } } diff --git a/tests/DependencyInjection/ConfigurationTest.php b/tests/DependencyInjection/ConfigurationTest.php index b5f3453..f623430 100644 --- a/tests/DependencyInjection/ConfigurationTest.php +++ b/tests/DependencyInjection/ConfigurationTest.php @@ -39,7 +39,7 @@ public function testDefaultConfiguration(): void ], ]; - static::assertSame($expected, $this->processConfiguration([[]])); + self::assertSame($expected, $this->processConfiguration([[]])); } public function testKeysAreNotNormalized(): void @@ -62,7 +62,7 @@ public function testKeysAreNotNormalized(): void $values ); - static::assertSame($expected, $config); + self::assertSame($expected, $config); } public function testWithYamlConfig(): void @@ -80,9 +80,9 @@ public function testWithYamlConfig(): void $values ); - static::assertSame($expected, $config); + self::assertSame($expected, $config); - static::assertSame('website', $config['page']['metas']['property']['og:type']); + self::assertSame('website', $config['page']['metas']['property']['og:type']); } /** diff --git a/tests/DependencyInjection/NucleosSeoExtensionTest.php b/tests/DependencyInjection/NucleosSeoExtensionTest.php index bb59474..bec8ad0 100644 --- a/tests/DependencyInjection/NucleosSeoExtensionTest.php +++ b/tests/DependencyInjection/NucleosSeoExtensionTest.php @@ -55,14 +55,14 @@ public function testBlocksLoading(): void $extension = new NucleosSeoExtension(); $extension->load([[]], $container); - static::assertTrue($container->hasDefinition('nucleos_seo.block.breadcrumb.homepage')); + self::assertTrue($container->hasDefinition('nucleos_seo.block.breadcrumb.homepage')); $container = new ContainerBuilder(); $container->setParameter('kernel.bundles', []); $extension->load([[]], $container); - static::assertFalse($container->hasDefinition('nucleos_seo.block.breadcrumb.homepage')); + self::assertFalse($container->hasDefinition('nucleos_seo.block.breadcrumb.homepage')); } public function testLoadWithCacheService(): void diff --git a/tests/Fixtures/InvalidArgumentException.php b/tests/Fixtures/InvalidArgumentException.php index 3d9882f..25ddb9a 100644 --- a/tests/Fixtures/InvalidArgumentException.php +++ b/tests/Fixtures/InvalidArgumentException.php @@ -14,6 +14,4 @@ use Exception; use Psr\SimpleCache\InvalidArgumentException as PsrException; -final class InvalidArgumentException extends Exception implements PsrException -{ -} +final class InvalidArgumentException extends Exception implements PsrException {} diff --git a/tests/Fixtures/SitemapDefinitionStub.php b/tests/Fixtures/SitemapDefinitionStub.php index 69b75bc..a241874 100644 --- a/tests/Fixtures/SitemapDefinitionStub.php +++ b/tests/Fixtures/SitemapDefinitionStub.php @@ -32,9 +32,7 @@ public function getTtl(): int return 42; } - public function setSettings(array $settings = []): void - { - } + public function setSettings(array $settings = []): void {} public function getSettings(): array { diff --git a/tests/Generator/SitemapGeneratorTest.php b/tests/Generator/SitemapGeneratorTest.php index d46b57b..5cf814b 100644 --- a/tests/Generator/SitemapGeneratorTest.php +++ b/tests/Generator/SitemapGeneratorTest.php @@ -73,7 +73,7 @@ public function testToXMLWithInvalidDefinition(): void $this->defintionManager ); - static::assertSame($expected, $generator->toXML()); + self::assertSame($expected, $generator->toXML()); } public function testToXMLWithNoEntries(): void @@ -93,7 +93,7 @@ public function testToXMLWithNoEntries(): void $this->defintionManager ); - static::assertSame($expected, $generator->toXML()); + self::assertSame($expected, $generator->toXML()); } public function testToXML(): void @@ -143,7 +143,7 @@ public function testToXML(): void $this->defintionManager ); - static::assertSame($expected, $generator->toXML()); + self::assertSame($expected, $generator->toXML()); } public function testToXMLWithExistingCache(): void @@ -186,10 +186,10 @@ public function testToXMLWithExistingCache(): void ; $cache = $this->createMock(CacheInterface::class); - $cache->method('has')->with(static::stringStartsWith('Sitemap_')) + $cache->method('has')->with(self::stringStartsWith('Sitemap_')) ->willReturn(true) ; - $cache->method('get')->with(static::stringStartsWith('Sitemap_')) + $cache->method('get')->with(self::stringStartsWith('Sitemap_')) ->willReturn($xmlEntry) ; @@ -199,7 +199,7 @@ public function testToXMLWithExistingCache(): void $cache ); - static::assertSame($expected, $generator->toXML()); + self::assertSame($expected, $generator->toXML()); } /** @@ -250,10 +250,10 @@ public function testToXMLWithExpiredCache(): void ; $cache = $this->createMock(CacheInterface::class); - $cache->method('has')->with(static::stringStartsWith('Sitemap_')) + $cache->method('has')->with(self::stringStartsWith('Sitemap_')) ->willReturn(false) ; - $cache->method('set')->with(static::stringStartsWith('Sitemap_'), $xmlEntry, 42); + $cache->method('set')->with(self::stringStartsWith('Sitemap_'), $xmlEntry, 42); $generator = new SitemapGenerator( $this->sitemapServiceManager, @@ -261,7 +261,7 @@ public function testToXMLWithExpiredCache(): void $cache ); - static::assertSame($expected, $generator->toXML()); + self::assertSame($expected, $generator->toXML()); } public function testToXMLWithCacheException(): void @@ -282,7 +282,7 @@ public function testToXMLWithCacheException(): void ; $cache = $this->createMock(CacheInterface::class); - $cache->method('has')->with(static::stringStartsWith('Sitemap_')) + $cache->method('has')->with(self::stringStartsWith('Sitemap_')) ->willThrowException(new InvalidArgumentException()) ; diff --git a/tests/NucleosSeoBundleTest.php b/tests/NucleosSeoBundleTest.php index e1eea9d..12ba850 100644 --- a/tests/NucleosSeoBundleTest.php +++ b/tests/NucleosSeoBundleTest.php @@ -22,13 +22,13 @@ public function testGetContainerExtension(): void { $bundle = new NucleosSeoBundle(); - static::assertInstanceOf(NucleosSeoExtension::class, $bundle->getContainerExtension()); + self::assertInstanceOf(NucleosSeoExtension::class, $bundle->getContainerExtension()); } public function testBuild(): void { $containerBuilder = $this->createMock(ContainerBuilder::class); - $containerBuilder->expects(static::exactly(3))->method('addCompilerPass'); + $containerBuilder->expects(self::exactly(3))->method('addCompilerPass'); $bundle = new NucleosSeoBundle(); $bundle->build($containerBuilder); diff --git a/tests/Seo/SeoPageTest.php b/tests/Seo/SeoPageTest.php index 3758a8e..a8b1c7e 100644 --- a/tests/Seo/SeoPageTest.php +++ b/tests/Seo/SeoPageTest.php @@ -33,7 +33,7 @@ public function testAddMeta(): void 'property' => ['foo' => ['bar', []]], ]; - static::assertSame($expected, $page->getMetas()); + self::assertSame($expected, $page->getMetas()); } public function testOverrideMetas(): void @@ -45,7 +45,7 @@ public function testOverrideMetas(): void 'property' => ['foo' => ['bar', []], 'foo2' => ['bar2', []]], ]; - static::assertSame($expected, $page->getMetas()); + self::assertSame($expected, $page->getMetas()); } public function testRemoveMeta(): void @@ -54,7 +54,7 @@ public function testRemoveMeta(): void $page->setMetas(['property' => ['foo' => 'bar', 'foo2' => ['bar2', []]]]); $page->removeMeta('property', 'foo'); - static::assertFalse($page->hasMeta('property', 'foo')); + self::assertFalse($page->hasMeta('property', 'foo')); } /** @@ -82,11 +82,11 @@ public function testHtmlAttributes(): void 'key2' => 'value2', ]; - static::assertSame($expected, $page->getHtmlAttributes()); + self::assertSame($expected, $page->getHtmlAttributes()); - static::assertTrue($page->hasHtmlAttribute('key2')); + self::assertTrue($page->hasHtmlAttribute('key2')); $page->removeHtmlAttributes('key2'); - static::assertFalse($page->hasHtmlAttribute('key2')); + self::assertFalse($page->hasHtmlAttribute('key2')); } public function testHeadAttributes(): void @@ -100,11 +100,11 @@ public function testHeadAttributes(): void 'head2' => 'value2', ]; - static::assertSame($expected, $page->getHeadAttributes()); + self::assertSame($expected, $page->getHeadAttributes()); - static::assertTrue($page->hasHeadAttribute('head1')); + self::assertTrue($page->hasHeadAttribute('head1')); $page->removeHeadAttribute('head1'); - static::assertFalse($page->hasHeadAttribute('head1')); + self::assertFalse($page->hasHeadAttribute('head1')); } public function testSetTitle(): void @@ -112,7 +112,7 @@ public function testSetTitle(): void $page = new SeoPage(); $page->setTitle('My title'); - static::assertSame('My title', $page->getTitle()); + self::assertSame('My title', $page->getTitle()); } public function addTitlePrefix(): void @@ -122,8 +122,8 @@ public function addTitlePrefix(): void $page->setSeparator(' - '); $page->addTitlePrefix('Additional title'); - static::assertSame('Additional title - My title', $page->getTitle()); - static::assertSame('My title', $page->getOriginalTitle()); + self::assertSame('Additional title - My title', $page->getTitle()); + self::assertSame('My title', $page->getOriginalTitle()); } public function addTitleSuffix(): void @@ -133,8 +133,8 @@ public function addTitleSuffix(): void $page->setSeparator(' - '); $page->addTitleSuffix('Additional title'); - static::assertSame('My title - Additional title', $page->getTitle()); - static::assertSame('My title', $page->getOriginalTitle()); + self::assertSame('My title - Additional title', $page->getTitle()); + self::assertSame('My title', $page->getOriginalTitle()); } public function testLinkCanonical(): void @@ -142,10 +142,10 @@ public function testLinkCanonical(): void $page = new SeoPage(); $page->setLinkCanonical('http://example.com'); - static::assertSame('http://example.com', $page->getLinkCanonical()); + self::assertSame('http://example.com', $page->getLinkCanonical()); $page->removeLinkCanonical(); - static::assertSame('', $page->getLinkCanonical()); + self::assertSame('', $page->getLinkCanonical()); } public function testLangAlternates(): void @@ -159,11 +159,11 @@ public function testLangAlternates(): void 'http://example.com/en-us' => 'en-us', ]; - static::assertSame($expected, $page->getLangAlternates()); + self::assertSame($expected, $page->getLangAlternates()); - static::assertTrue($page->hasLangAlternate('http://example.com/')); + self::assertTrue($page->hasLangAlternate('http://example.com/')); $page->removeLangAlternate('http://example.com/'); - static::assertFalse($page->hasLangAlternate('http://example.com/')); + self::assertFalse($page->hasLangAlternate('http://example.com/')); } /** @@ -174,7 +174,7 @@ public function testHasMeta(): void $page = new SeoPage(); $page->addMeta('property', 'test', ''); - static::assertTrue($page->hasMeta('property', 'test')); - static::assertFalse($page->hasMeta('property', 'fake')); + self::assertTrue($page->hasMeta('property', 'test')); + self::assertFalse($page->hasMeta('property', 'fake')); } } diff --git a/tests/Sitemap/Definition/DefinitionManagerTest.php b/tests/Sitemap/Definition/DefinitionManagerTest.php index a203341..e5b3731 100644 --- a/tests/Sitemap/Definition/DefinitionManagerTest.php +++ b/tests/Sitemap/Definition/DefinitionManagerTest.php @@ -25,8 +25,8 @@ public function testAddDefintion(): void ]); foreach ($definition->getAll() as $item) { - static::assertInstanceOf(SitemapDefinition::class, $item); - static::assertSame([ + self::assertInstanceOf(SitemapDefinition::class, $item); + self::assertSame([ 'foo' => 'bar', ], $item->getSettings()); } diff --git a/tests/Sitemap/Definition/SitemapDefintionTest.php b/tests/Sitemap/Definition/SitemapDefintionTest.php index 33b29f3..b7aa35f 100644 --- a/tests/Sitemap/Definition/SitemapDefintionTest.php +++ b/tests/Sitemap/Definition/SitemapDefintionTest.php @@ -20,10 +20,10 @@ public function testItIsInstantiable(): void { $definition = new SitemapDefinition('acme.sitemap'); - static::assertSame('acme.sitemap', $definition->getType()); - static::assertSame('acme.sitemap', $definition->toString()); - static::assertSame('acme.sitemap', $definition->__toString()); - static::assertSame([], $definition->getSettings()); + self::assertSame('acme.sitemap', $definition->getType()); + self::assertSame('acme.sitemap', $definition->toString()); + self::assertSame('acme.sitemap', $definition->__toString()); + self::assertSame([], $definition->getSettings()); } public function testSetting(): void @@ -33,14 +33,14 @@ public function testSetting(): void 'foo'=> 'bar', ]); - static::assertSame('bar', $definition->getSetting('foo')); + self::assertSame('bar', $definition->getSetting('foo')); } public function testSettingWithDefault(): void { $definition = new SitemapDefinition('acme.sitemap'); - static::assertSame('baz', $definition->getSetting('foo', 'baz')); + self::assertSame('baz', $definition->getSetting('foo', 'baz')); } public function testTtl(): void @@ -50,7 +50,7 @@ public function testTtl(): void 'ttl' => 90, ]); - static::assertSame(90, $definition->getTtl()); + self::assertSame(90, $definition->getTtl()); } public function testTtlWithoutCache(): void @@ -59,13 +59,13 @@ public function testTtlWithoutCache(): void 'use_cache' => false, ]); - static::assertSame(0, $definition->getTtl()); + self::assertSame(0, $definition->getTtl()); } public function testTtlDefault(): void { $definition = new SitemapDefinition('acme.sitemap'); - static::assertSame(0, $definition->getTtl()); + self::assertSame(0, $definition->getTtl()); } } diff --git a/tests/Sitemap/SitemapServiceManagerTest.php b/tests/Sitemap/SitemapServiceManagerTest.php index 7e61ec0..ad759d9 100644 --- a/tests/Sitemap/SitemapServiceManagerTest.php +++ b/tests/Sitemap/SitemapServiceManagerTest.php @@ -45,8 +45,8 @@ public function testGet(): void ]); $result = $manager->get($definition); - static::assertInstanceOf(SitemapServiceInterface::class, $result); - static::assertSame([ + self::assertInstanceOf(SitemapServiceInterface::class, $result); + self::assertSame([ 'custom' => 'foo', 'use_cache' => true, 'extra_cache_keys' => [], @@ -70,8 +70,8 @@ public function testGetWithOverride(): void ]); $result = $manager->get($definition); - static::assertInstanceOf(SitemapServiceInterface::class, $result); - static::assertSame([ + self::assertInstanceOf(SitemapServiceInterface::class, $result); + self::assertSame([ 'use_cache' => false, 'extra_cache_keys' => ['my-key'], 'ttl' => 0, @@ -122,6 +122,6 @@ public function testAddSitemap(): void $definition = new SitemapDefinitionStub('my-type'); - static::assertSame($service, $manager->get($definition)); + self::assertSame($service, $manager->get($definition)); } } diff --git a/tests/Twig/Extension/SeoExtensionTest.php b/tests/Twig/Extension/SeoExtensionTest.php index 5d64825..be4090a 100644 --- a/tests/Twig/Extension/SeoExtensionTest.php +++ b/tests/Twig/Extension/SeoExtensionTest.php @@ -21,14 +21,14 @@ final class SeoExtensionTest extends TestCase public function testHtmlAttributes(): void { $page = $this->createMock(SeoPageInterface::class); - $page->expects(static::once())->method('getHtmlAttributes')->willReturn([ + $page->expects(self::once())->method('getHtmlAttributes')->willReturn([ 'xmlns' => 'http://www.w3.org/1999/xhtml', 'xmlns:og' => 'http://opengraphprotocol.org/schema/', ]); $extension = new SeoExtension($page, 'UTF-8'); - static::assertSame( + self::assertSame( 'xmlns="http://www.w3.org/1999/xhtml" xmlns:og="http://opengraphprotocol.org/schema/"', $extension->getHtmlAttributes() ); @@ -37,38 +37,38 @@ public function testHtmlAttributes(): void public function testHeadAttributes(): void { $page = $this->createMock(SeoPageInterface::class); - $page->expects(static::once())->method('getHeadAttributes')->willReturn([]); + $page->expects(self::once())->method('getHeadAttributes')->willReturn([]); $extension = new SeoExtension($page, 'UTF-8'); - static::assertSame('', $extension->getHeadAttributes()); + self::assertSame('', $extension->getHeadAttributes()); } public function testTitle(): void { $page = $this->createMock(SeoPageInterface::class); - $page->expects(static::once())->method('getTitle')->willReturn('foo bar'); + $page->expects(self::once())->method('getTitle')->willReturn('foo bar'); $extension = new SeoExtension($page, 'UTF-8'); - static::assertSame('foo bar', $extension->getTitle()); + self::assertSame('foo bar', $extension->getTitle()); } public function getTitleText(): void { $page = $this->createMock(SeoPageInterface::class); - $page->expects(static::once())->method('getTitle')->willReturn('foo bar'); + $page->expects(self::once())->method('getTitle')->willReturn('foo bar'); $extension = new SeoExtension($page, 'UTF-8'); - static::assertSame('foo bar', $extension->getTitleText()); + self::assertSame('foo bar', $extension->getTitleText()); } public function testEncoding(): void { $page = $this->createMock(SeoPageInterface::class); - $page->expects(static::once())->method('getTitle')->willReturn('pięć głów zatkniętych na pal'); - $page->expects(static::once())->method('getMetas')->willReturn([ + $page->expects(self::once())->method('getTitle')->willReturn('pięć głów zatkniętych na pal'); + $page->expects(self::once())->method('getMetas')->willReturn([ 'http-equiv' => [], 'name' => ['foo' => ['pięć głów zatkniętych na pal', []]], 'schema' => [], @@ -78,9 +78,9 @@ public function testEncoding(): void $extension = new SeoExtension($page, 'UTF-8'); - static::assertSame('pięć głów zatkniętych na pal', $extension->getTitle()); + self::assertSame('pięć głów zatkniętych na pal', $extension->getTitle()); - static::assertSame( + self::assertSame( "\n", $extension->getMetadatas() ); @@ -89,7 +89,7 @@ public function testEncoding(): void public function testMetadatas(): void { $page = $this->createMock(SeoPageInterface::class); - $page->expects(static::once())->method('getMetas')->willReturn([ + $page->expects(self::once())->method('getMetas')->willReturn([ 'http-equiv' => [], 'name' => ['foo' => ['bar "\'"', []]], 'schema' => [], @@ -102,7 +102,7 @@ public function testMetadatas(): void $extension = new SeoExtension($page, 'UTF-8'); - static::assertSame( + self::assertSame( "\n\n\n\n", $extension->getMetadatas() ); @@ -113,17 +113,17 @@ public function testName(): void $page = $this->createMock(SeoPageInterface::class); $extension = new SeoExtension($page, 'UTF-8'); - static::assertSame('nucleos_seo', $extension->getName()); + self::assertSame('nucleos_seo', $extension->getName()); } public function testLinkCanonical(): void { $page = $this->createMock(SeoPageInterface::class); - $page->expects(static::any())->method('getLinkCanonical')->willReturn('http://example.com'); + $page->expects(self::any())->method('getLinkCanonical')->willReturn('http://example.com'); $extension = new SeoExtension($page, 'UTF-8'); - static::assertSame( + self::assertSame( "\n", $extension->getLinkCanonical() ); @@ -132,13 +132,13 @@ public function testLinkCanonical(): void public function testLangAlternates(): void { $page = $this->createMock(SeoPageInterface::class); - $page->expects(static::once())->method('getLangAlternates')->willReturn([ + $page->expects(self::once())->method('getLangAlternates')->willReturn([ 'http://example.com/' => 'x-default', ]); $extension = new SeoExtension($page, 'UTF-8'); - static::assertSame( + self::assertSame( "\n", $extension->getLangAlternates() ); @@ -147,13 +147,13 @@ public function testLangAlternates(): void public function testOEmbedLinks(): void { $page = $this->createMock(SeoPageInterface::class); - $page->expects(static::once())->method('getOembedLinks')->willReturn([ + $page->expects(self::once())->method('getOembedLinks')->willReturn([ 'Foo' => 'http://example.com/', ]); $extension = new SeoExtension($page, 'UTF-8'); - static::assertSame( + self::assertSame( "\n", $extension->getOembedLinks() );