Skip to content

Commit

Permalink
chore: update phpunit to 10.5
Browse files Browse the repository at this point in the history
  • Loading branch information
brotkrueml committed Feb 12, 2024
1 parent abbea81 commit c39ab4a
Show file tree
Hide file tree
Showing 17 changed files with 96 additions and 196 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,5 +1,6 @@
.Build
.idea
.phpunit.cache
composer.lock
node_modules
yarn-error.log
Expand Down
23 changes: 0 additions & 23 deletions Tests/Hooks/Typo3ConstantsHook.php

This file was deleted.

9 changes: 3 additions & 6 deletions Tests/Unit/Collector/AssetCollectorTest.php
Expand Up @@ -12,23 +12,20 @@
namespace Brotkrueml\CodeHighlight\Tests\Unit\Collector;

use Brotkrueml\CodeHighlight\Collector\AssetCollector;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

final class AssetCollectorTest extends TestCase
{
/**
* @test
*/
#[Test]
public function getPathsIsEmptyAfterInstantiation(): void
{
$subject = new AssetCollector();

self::assertSame([], $subject->getPaths());
}

/**
* @test
*/
#[Test]
public function addPathAndGetPaths(): void
{
$subject = new AssetCollector();
Expand Down
17 changes: 5 additions & 12 deletions Tests/Unit/Collector/TagAttributeValuesCollectorTest.php
Expand Up @@ -12,23 +12,20 @@
namespace Brotkrueml\CodeHighlight\Tests\Unit\Collector;

use Brotkrueml\CodeHighlight\Collector\TagAttributeValuesCollector;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

final class TagAttributeValuesCollectorTest extends TestCase
{
/**
* @test
*/
#[Test]
public function toStringReturnsEmptyStringAfterInstantiation(): void
{
$subject = new TagAttributeValuesCollector();

self::assertSame('', $subject->__toString());
}

/**
* @test
*/
#[Test]
public function toStringReturnsOneValueCorrectly(): void
{
$subject = new TagAttributeValuesCollector();
Expand All @@ -38,9 +35,7 @@ public function toStringReturnsOneValueCorrectly(): void
self::assertSame('some-value', $subject->__toString());
}

/**
* @test
*/
#[Test]
public function toStringReturnsTwoValueCorrectly(): void
{
$subject = new TagAttributeValuesCollector();
Expand All @@ -51,9 +46,7 @@ public function toStringReturnsTwoValueCorrectly(): void
self::assertSame('some-value another-value', $subject->__toString());
}

/**
* @test
*/
#[Test]
public function valuesAreMaskedCorrectly(): void
{
$subject = new TagAttributeValuesCollector();
Expand Down
17 changes: 5 additions & 12 deletions Tests/Unit/Collector/TagAttributesCollectorTest.php
Expand Up @@ -12,26 +12,23 @@
namespace Brotkrueml\CodeHighlight\Tests\Unit\Collector;

use Brotkrueml\CodeHighlight\Collector\TagAttributesCollector;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

/**
* @internal
*/
final class TagAttributesCollectorTest extends TestCase
{
/**
* @test
*/
#[Test]
public function toStringReturnsEmptyStringAfterInstantiation(): void
{
$subject = new TagAttributesCollector();

self::assertSame('', $subject->__toString());
}

/**
* @test
*/
#[Test]
public function toStringReturnsOneAttributeCorrectly(): void
{
$subject = new TagAttributesCollector();
Expand All @@ -41,9 +38,7 @@ public function toStringReturnsOneAttributeCorrectly(): void
self::assertSame('some-attribute="some-value"', $subject->__toString());
}

/**
* @test
*/
#[Test]
public function toStringReturnsTwoAttributesCorrectly(): void
{
$subject = new TagAttributesCollector();
Expand All @@ -54,9 +49,7 @@ public function toStringReturnsTwoAttributesCorrectly(): void
self::assertSame('some-attribute="some-value" another-attribute="another-value"', $subject->__toString());
}

/**
* @test
*/
#[Test]
public function attributesAreMaskedCorrectly(): void
{
$subject = new TagAttributesCollector();
Expand Down
25 changes: 7 additions & 18 deletions Tests/Unit/Configuration/OptionsTest.php
Expand Up @@ -12,13 +12,12 @@
namespace Brotkrueml\CodeHighlight\Tests\Unit\Configuration;

use Brotkrueml\CodeHighlight\Configuration\Options;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

final class OptionsTest extends TestCase
{
/**
* @test
*/
#[Test]
public function fallbackValuesAreAssignedWhenOptionIsNotAvailable(): void
{
$subject = new Options([]);
Expand All @@ -38,9 +37,7 @@ public function fallbackValuesAreAssignedWhenOptionIsNotAvailable(): void
self::assertFalse($subject->treeview);
}

/**
* @test
*/
#[Test]
public function stringAndIntValuesAreCorrectlyAssigned(): void
{
$subject = new Options([
Expand All @@ -66,9 +63,7 @@ public function stringAndIntValuesAreCorrectlyAssigned(): void
self::assertSame('(filter)', $subject->commandLineOutputFilter);
}

/**
* @test
*/
#[Test]
public function showLineNumbersSetToTrue(): void
{
$subject = new Options([
Expand All @@ -78,9 +73,7 @@ public function showLineNumbersSetToTrue(): void
self::assertTrue($subject->showLineNumbers);
}

/**
* @test
*/
#[Test]
public function showDisplayCommandLineSetToTrue(): void
{
$subject = new Options([
Expand All @@ -90,9 +83,7 @@ public function showDisplayCommandLineSetToTrue(): void
self::assertTrue($subject->displayCommandLine);
}

/**
* @test
*/
#[Test]
public function inlineColourSetToTrue(): void
{
$subject = new Options([
Expand All @@ -102,9 +93,7 @@ public function inlineColourSetToTrue(): void
self::assertTrue($subject->inlineColour);
}

/**
* @test
*/
#[Test]
public function treeviewSetToTrue(): void
{
$subject = new Options([
Expand Down
17 changes: 5 additions & 12 deletions Tests/Unit/Configuration/SiteConfigurationTest.php
Expand Up @@ -12,13 +12,12 @@
namespace Brotkrueml\CodeHighlight\Tests\Unit\Configuration;

use Brotkrueml\CodeHighlight\Configuration\SiteConfiguration;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;

final class SiteConfigurationTest extends TestCase
{
/**
* @test
*/
#[Test]
public function fallbackValuesAreAssignedWhenConfigurationIsNotAvailable(): void
{
$subject = new SiteConfiguration([]);
Expand All @@ -30,9 +29,7 @@ public function fallbackValuesAreAssignedWhenConfigurationIsNotAvailable(): void
self::assertFalse($subject->useUrlHash);
}

/**
* @test
*/
#[Test]
public function stringValuesAreCorrectlyAssigned(): void
{
$subject = new SiteConfiguration([
Expand All @@ -46,9 +43,7 @@ public function stringValuesAreCorrectlyAssigned(): void
self::assertSame('some-user', $subject->commandLineDefaultUser);
}

/**
* @test
*/
#[Test]
public function toolbarCopyToClipboardSetToTrue(): void
{
$subject = new SiteConfiguration([
Expand All @@ -58,9 +53,7 @@ public function toolbarCopyToClipboardSetToTrue(): void
self::assertTrue($subject->toolbarCopyToClipboard);
}

/**
* @test
*/
#[Test]
public function codehighlightUseUrlHash(): void
{
$subject = new SiteConfiguration([
Expand Down
19 changes: 8 additions & 11 deletions Tests/Unit/EventListener/CommandLineTest.php
Expand Up @@ -15,19 +15,18 @@
use Brotkrueml\CodeHighlight\Configuration\SiteConfiguration;
use Brotkrueml\CodeHighlight\EventListener\CommandLine;
use Brotkrueml\CodeHighlight\Tests\Traits\CreateEnrichCodeSnippetEventTrait;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ServerRequestInterface;

/**
* @covers \Brotkrueml\CodeHighlight\EventListener\CommandLine
*/
#[CoversClass(CommandLine::class)]
final class CommandLineTest extends TestCase
{
use CreateEnrichCodeSnippetEventTrait;

/**
* @test
*/
#[Test]
public function commandLineIsDeactivated(): void
{
$event = $this->createEnrichCodeSnippetEvent(
Expand All @@ -47,10 +46,8 @@ public function commandLineIsDeactivated(): void
self::assertSame('', $event->codeClassesCollector->__toString());
}

/**
* @test
* @dataProvider provider
*/
#[Test]
#[DataProvider('provider')]
public function commandLineIsActivated(array $options, array $siteConfiguration, string $expectedPreAttributes): void
{
$event = $this->createEnrichCodeSnippetEvent(
Expand All @@ -72,7 +69,7 @@ public function commandLineIsActivated(array $options, array $siteConfiguration,
self::assertSame('', $event->codeClassesCollector->__toString());
}

public function provider(): iterable
public static function provider(): iterable
{
yield 'commandLineOutputLines is given' => [
'options' => [
Expand Down
14 changes: 5 additions & 9 deletions Tests/Unit/EventListener/CopyToClipboardTest.php
Expand Up @@ -15,6 +15,8 @@
use Brotkrueml\CodeHighlight\Configuration\SiteConfiguration;
use Brotkrueml\CodeHighlight\EventListener\CopyToClipboard;
use Brotkrueml\CodeHighlight\Tests\Traits\CreateEnrichCodeSnippetEventTrait;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\MockObject\Stub;
use PHPUnit\Framework\TestCase;
use Psr\Http\Message\ServerRequestInterface;
Expand All @@ -23,9 +25,7 @@
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
use TYPO3\CMS\Core\Site\Entity\SiteLanguage;

/**
* @covers \Brotkrueml\CodeHighlight\EventListener\CopyToClipboard
*/
#[CoversClass(CopyToClipboard::class)]
final class CopyToClipboardTest extends TestCase
{
use CreateEnrichCodeSnippetEventTrait;
Expand All @@ -48,9 +48,7 @@ protected function setUp(): void
->willReturn($languageServiceStub);
}

/**
* @test
*/
#[Test]
public function copyToClipboardIsDeactivated(): void
{
$event = $this->createEnrichCodeSnippetEvent(
Expand All @@ -70,9 +68,7 @@ public function copyToClipboardIsDeactivated(): void
self::assertSame('', $event->codeClassesCollector->__toString());
}

/**
* @test
*/
#[Test]
public function copyToClipboardIsActivated(): void
{
$requestStub = $this->createStub(ServerRequestInterface::class);
Expand Down

0 comments on commit c39ab4a

Please sign in to comment.