Skip to content

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
core23 committed Dec 5, 2023
1 parent 2818fdb commit 9b26b59
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 37 deletions.
5 changes: 5 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ parameters:
count: 1
path: tests/Block/Service/GDPRInformationBlockServiceIntegrationTest.php

-
message: "#^Dynamic call to static method PHPUnit\\\\Framework\\\\TestCase\\:\\:createStub\\(\\)\\.$#"
count: 10
path: tests/EventListener/KernelEventSubscriberTest.php

13 changes: 7 additions & 6 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" bootstrap="tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache">
<coverage>
<include>
<directory suffix=".php">./src/</directory>
</include>
</coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" colors="true" processIsolation="false" stopOnFailure="false" bootstrap="tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache">
<coverage/>
<php>
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0"/>
</php>
Expand All @@ -13,4 +9,9 @@
<directory>./tests/</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory suffix=".php">./src/</directory>
</include>
</source>
</phpunit>
2 changes: 1 addition & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="3.14.2@3538fe1955d47f6ee926c0769d71af6db08aa488"/>
<files psalm-version="5.16.0@2897ba636551a8cb61601cc26f6ccfbba6c36591"/>
4 changes: 1 addition & 3 deletions src/Block/Service/GDPRInformationBlockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ public function configureSettings(OptionsResolver $resolver): void
]);
}

public function validate(ErrorElement $errorElement, BlockInterface $block): void
{
}
public function validate(ErrorElement $errorElement, BlockInterface $block): void {}

public function getMetadata(): MetadataInterface
{
Expand Down
4 changes: 1 addition & 3 deletions src/NucleosGDPRBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@

use Symfony\Component\HttpKernel\Bundle\Bundle;

final class NucleosGDPRBundle extends Bundle
{
}
final class NucleosGDPRBundle extends Bundle {}
1 change: 0 additions & 1 deletion src/Resources/config/block.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@
new Reference('twig'),
new Reference('request_stack'),
])

;
};
1 change: 0 additions & 1 deletion src/Resources/config/listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@
null,
false,
])

;
};
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ public function testRender(): void

$client->request('GET', '/twig-test');

static::assertSame(200, $client->getResponse()->getStatusCode());
self::assertSame(200, $client->getResponse()->getStatusCode());
}
}
18 changes: 9 additions & 9 deletions tests/Block/Service/GDPRInformationBlockServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function testExecute(): void

$response = new Response();

$this->twig->expects(static::once())->method('render')
$this->twig->expects(self::once())->method('render')
->with(
'@NucleosGDPR/Block/block_gdpr.html.twig',
[
Expand All @@ -84,8 +84,8 @@ public function testExecute(): void

$blockService = new GDPRInformationBlockService($this->twig, $this->requestStack);

static::assertSame($response, $blockService->execute($blockContext, $response));
static::assertSame('TWIG_CONTENT', $response->getContent());
self::assertSame($response, $blockService->execute($blockContext, $response));
self::assertSame('TWIG_CONTENT', $response->getContent());
}

public function testExecuteWithExistingCookie(): void
Expand All @@ -104,7 +104,7 @@ public function testExecuteWithExistingCookie(): void
$blockService = new GDPRInformationBlockService($this->twig, $this->requestStack);
$response = $blockService->execute($blockContext);

static::assertTrue($response->isEmpty());
self::assertTrue($response->isEmpty());
}

public function testGetMetadata(): void
Expand All @@ -113,10 +113,10 @@ public function testGetMetadata(): void

$metadata = $blockService->getMetadata();

static::assertSame('nucleos_gdpr.block.information', $metadata->getTitle());
static::assertNull($metadata->getImage());
static::assertSame('NucleosGDPRBundle', $metadata->getDomain());
static::assertSame([
self::assertSame('nucleos_gdpr.block.information', $metadata->getTitle());
self::assertNull($metadata->getImage());
self::assertSame('NucleosGDPRBundle', $metadata->getDomain());
self::assertSame([
'class' => 'fa fa-balance-scale',
], $metadata->getOptions());
}
Expand All @@ -128,7 +128,7 @@ public function testConfigureEditForm(): void
$block = new Block();

$formMapper = $this->createMock(FormMapper::class);
$formMapper->expects(static::once())->method('add');
$formMapper->expects(self::once())->method('add');

$blockService->configureEditForm($formMapper, $block);
}
Expand Down
8 changes: 4 additions & 4 deletions tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function testDefaultOptions(): void
],
];

static::assertSame($expected, $config);
self::assertSame($expected, $config);
}

public function testEnabledGoogleFLoC(): void
Expand All @@ -48,7 +48,7 @@ public function testEnabledGoogleFLoC(): void
],
];

static::assertSame($expected, $config);
self::assertSame($expected, $config);
}

public function testBlockedCookieEnabled(): void
Expand All @@ -68,7 +68,7 @@ public function testBlockedCookieEnabled(): void
],
];

static::assertSame($expected, $config);
self::assertSame($expected, $config);
}

public function testBlockedCookieOptions(): void
Expand All @@ -90,6 +90,6 @@ public function testBlockedCookieOptions(): void
],
];

static::assertSame($expected, $config);
self::assertSame($expected, $config);
}
}
14 changes: 7 additions & 7 deletions tests/EventListener/KernelEventSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function testCleanCookiesWithDisabledOption(): void
$subscriber = new KernelEventSubscriber(null);
$subscriber->cleanCookies($event);

static::assertCount(4, $response->headers->getCookies());
self::assertCount(4, $response->headers->getCookies());
$this->assertHasCookie(self::SOME_COOKIE_NAME, $response);
$this->assertHasCookie(self::KEEP_COOKIE_NAME, $response);
$this->assertHasCookie(self::KEEP_REGED_EXAMPLE, $response);
Expand Down Expand Up @@ -73,7 +73,7 @@ public function testCleanCookiesWithConsent(): void
]);
$subscriber->cleanCookies($event);

static::assertCount(4, $response->headers->getCookies());
self::assertCount(4, $response->headers->getCookies());
$this->assertHasCookie(self::SOME_COOKIE_NAME, $response);
$this->assertHasCookie(self::KEEP_COOKIE_NAME, $response);
$this->assertHasCookie(self::KEEP_REGED_EXAMPLE, $response);
Expand All @@ -100,7 +100,7 @@ public function testCleanCookiesWithNoConsent(): void
]);
$subscriber->cleanCookies($event);

static::assertCount(2, $response->headers->getCookies());
self::assertCount(2, $response->headers->getCookies());
$this->assertHasCookie(self::KEEP_COOKIE_NAME, $response);
$this->assertHasCookie(self::KEEP_REGED_EXAMPLE, $response);
}
Expand All @@ -119,8 +119,8 @@ public function testAddFLoCPolicy(): void
$subscriber = new KernelEventSubscriber(null, false);
$subscriber->addFLoCPolicy($event);

static::assertTrue($response->headers->has('Permissions-Policy'));
static::assertSame('interest-cohort=()', $response->headers->get('Permissions-Policy'));
self::assertTrue($response->headers->has('Permissions-Policy'));
self::assertSame('interest-cohort=()', $response->headers->get('Permissions-Policy'));
}

public function testAddFLoCPolicyWithDisabledOption(): void
Expand All @@ -137,12 +137,12 @@ public function testAddFLoCPolicyWithDisabledOption(): void
$subscriber = new KernelEventSubscriber(null, true);
$subscriber->addFLoCPolicy($event);

static::assertFalse($response->headers->has('Permissions-Policy'));
self::assertFalse($response->headers->has('Permissions-Policy'));
}

private function assertHasCookie(string $cookieName, Response $response): void
{
static::assertCount(1, array_filter($response->headers->getCookies(), static function (Cookie $cookie) use ($cookieName): bool {
self::assertCount(1, array_filter($response->headers->getCookies(), static function (Cookie $cookie) use ($cookieName): bool {
return $cookie->getName() === $cookieName;
}));
}
Expand Down
2 changes: 1 addition & 1 deletion tests/NucleosGDPRBundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public function testGetContainerExtension(): void
{
$bundle = new NucleosGDPRBundle();

static::assertInstanceOf(NucleosGDPRExtension::class, $bundle->getContainerExtension());
self::assertInstanceOf(NucleosGDPRExtension::class, $bundle->getContainerExtension());
}
}

0 comments on commit 9b26b59

Please sign in to comment.