Skip to content

Commit

Permalink
[TASK] Use phpunit attributes in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bnf committed Oct 17, 2024
1 parent 3365532 commit 4a8c0a2
Show file tree
Hide file tree
Showing 27 changed files with 95 additions and 144 deletions.
9 changes: 3 additions & 6 deletions Tests/Functional/Hooks/DataHandlerHookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace T3G\AgencyPack\Blog\Tests\Functional\Service;

use PHPUnit\Framework\Attributes\Test;
use T3G\AgencyPack\Blog\Constants;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\DataHandling\DataHandler;
Expand All @@ -37,9 +38,7 @@ protected function setUp(): void
$GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser);
}

/**
* @test
*/
#[Test]
public function create(): void
{
$this->importCSVDataSet(__DIR__ . '/Fixtures/BlogBasePages.csv');
Expand Down Expand Up @@ -86,9 +85,7 @@ public function create(): void
self::assertEquals($page['crdate_year'], 2023);
}

/**
* @test
*/
#[Test]
public function update(): void
{
$this->importCSVDataSet(__DIR__ . '/Fixtures/BlogBasePages.csv');
Expand Down
13 changes: 4 additions & 9 deletions Tests/Functional/Service/SetupServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace T3G\AgencyPack\Blog\Tests\Functional\Service;

use PHPUnit\Framework\Attributes\Test;
use T3G\AgencyPack\Blog\Constants;
use T3G\AgencyPack\Blog\Service\SetupService;
use TYPO3\CMS\Backend\Utility\BackendUtility;
Expand All @@ -37,9 +38,7 @@ protected function setUp(): void
$GLOBALS['LANG'] = $this->get(LanguageServiceFactory::class)->createFromUserPreferences($backendUser);
}

/**
* @test
*/
#[Test]
public function create(): void
{
$setupService = GeneralUtility::makeInstance(SetupService::class);
Expand All @@ -52,9 +51,7 @@ public function create(): void
self::assertEquals($rootPage['is_siteroot'], 1);
}

/**
* @test
*/
#[Test]
public function createWithName(): void
{
$setupService = GeneralUtility::makeInstance(SetupService::class);
Expand All @@ -67,9 +64,7 @@ public function createWithName(): void
self::assertEquals($rootPage['is_siteroot'], 1);
}

/**
* @test
*/
#[Test]
public function determineBlogSetups(): void
{
$setupService = GeneralUtility::makeInstance(SetupService::class);
Expand Down
9 changes: 3 additions & 6 deletions Tests/Functional/Updates/AuthorSlugUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace T3G\AgencyPack\Blog\Tests\Functional\Updates;

use PHPUnit\Framework\Attributes\Test;
use T3G\AgencyPack\Blog\Updates\AuthorSlugUpdate;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

Expand All @@ -27,18 +28,14 @@ final class AuthorSlugUpdateTest extends FunctionalTestCase
'typo3conf/ext/blog'
];

/**
* @test
*/
#[Test]
public function noUpdateNecessaryTest(): void
{
$subject = new AuthorSlugUpdate();
self::assertFalse($subject->updateNecessary());
}

/**
* @test
*/
#[Test]
public function updateTest(): void
{
$subject = new AuthorSlugUpdate();
Expand Down
9 changes: 3 additions & 6 deletions Tests/Functional/Updates/AvatarProviderUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace T3G\AgencyPack\Blog\Tests\Functional\Updates;

use PHPUnit\Framework\Attributes\Test;
use T3G\AgencyPack\Blog\Updates\AvatarProviderUpdate;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

Expand All @@ -27,18 +28,14 @@ final class AvatarProviderUpdateTest extends FunctionalTestCase
'typo3conf/ext/blog'
];

/**
* @test
*/
#[Test]
public function noUpdateNecessaryTest(): void
{
$subject = new AvatarProviderUpdate();
self::assertFalse($subject->updateNecessary());
}

/**
* @test
*/
#[Test]
public function updateTest(): void
{
$subject = new AvatarProviderUpdate();
Expand Down
9 changes: 3 additions & 6 deletions Tests/Functional/Updates/CategorySlugUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace T3G\AgencyPack\Blog\Tests\Functional\Updates;

use PHPUnit\Framework\Attributes\Test;
use T3G\AgencyPack\Blog\Updates\CategorySlugUpdate;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

Expand All @@ -27,18 +28,14 @@ final class CategorySlugUpdateTest extends FunctionalTestCase
'typo3conf/ext/blog'
];

/**
* @test
*/
#[Test]
public function noUpdateNecessaryTest(): void
{
$subject = new CategorySlugUpdate();
self::assertFalse($subject->updateNecessary());
}

/**
* @test
*/
#[Test]
public function updateTest(): void
{
$subject = new CategorySlugUpdate();
Expand Down
9 changes: 3 additions & 6 deletions Tests/Functional/Updates/CategoryTypeUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace T3G\AgencyPack\Blog\Tests\Functional\Updates;

use PHPUnit\Framework\Attributes\Test;
use T3G\AgencyPack\Blog\Updates\CategoryTypeUpdate;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

Expand All @@ -27,18 +28,14 @@ final class CategoryTypeUpdateTest extends FunctionalTestCase
'typo3conf/ext/blog'
];

/**
* @test
*/
#[Test]
public function noUpdateNecessaryTest(): void
{
$subject = new CategoryTypeUpdate();
self::assertFalse($subject->updateNecessary());
}

/**
* @test
*/
#[Test]
public function updateTest(): void
{
$subject = new CategoryTypeUpdate();
Expand Down
9 changes: 3 additions & 6 deletions Tests/Functional/Updates/CommentStatusUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace T3G\AgencyPack\Blog\Tests\Functional\Updates;

use PHPUnit\Framework\Attributes\Test;
use T3G\AgencyPack\Blog\Updates\CommentStatusUpdate;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

Expand All @@ -27,18 +28,14 @@ final class CommentStatusUpdateTest extends FunctionalTestCase
'typo3conf/ext/blog'
];

/**
* @test
*/
#[Test]
public function noUpdateNecessaryTest(): void
{
$subject = new CommentStatusUpdate();
self::assertFalse($subject->updateNecessary());
}

/**
* @test
*/
#[Test]
public function updateTest(): void
{
$subject = new CommentStatusUpdate();
Expand Down
9 changes: 3 additions & 6 deletions Tests/Functional/Updates/DatabaseMonthYearUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace T3G\AgencyPack\Blog\Tests\Functional\Updates;

use PHPUnit\Framework\Attributes\Test;
use T3G\AgencyPack\Blog\Updates\DatabaseMonthYearUpdate;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

Expand All @@ -27,18 +28,14 @@ final class DatabaseMonthYearUpdateTest extends FunctionalTestCase
'typo3conf/ext/blog'
];

/**
* @test
*/
#[Test]
public function noUpdateNecessaryTest(): void
{
$subject = new DatabaseMonthYearUpdate();
self::assertFalse($subject->updateNecessary());
}

/**
* @test
*/
#[Test]
public function updateTest(): void
{
$subject = new DatabaseMonthYearUpdate();
Expand Down
9 changes: 3 additions & 6 deletions Tests/Functional/Updates/DatabasePublishDateUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace T3G\AgencyPack\Blog\Tests\Functional\Updates;

use PHPUnit\Framework\Attributes\Test;
use T3G\AgencyPack\Blog\Updates\DatabasePublishDateUpdate;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

Expand All @@ -27,18 +28,14 @@ final class DatabasePublishDateUpdateTest extends FunctionalTestCase
'typo3conf/ext/blog'
];

/**
* @test
*/
#[Test]
public function noUpdateNecessaryTest(): void
{
$subject = new DatabasePublishDateUpdate();
self::assertFalse($subject->updateNecessary());
}

/**
* @test
*/
#[Test]
public function updateTest(): void
{
$subject = new DatabasePublishDateUpdate();
Expand Down
9 changes: 3 additions & 6 deletions Tests/Functional/Updates/FeaturedImageUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace T3G\AgencyPack\Blog\Tests\Functional\Updates;

use PHPUnit\Framework\Attributes\Test;
use T3G\AgencyPack\Blog\Updates\FeaturedImageUpdate;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

Expand All @@ -27,18 +28,14 @@ final class FeaturedImageUpdateTest extends FunctionalTestCase
'typo3conf/ext/blog'
];

/**
* @test
*/
#[Test]
public function noUpdateNecessaryTest(): void
{
$subject = new FeaturedImageUpdate();
self::assertFalse($subject->updateNecessary());
}

/**
* @test
*/
#[Test]
public function updateTest(): void
{
$subject = new FeaturedImageUpdate();
Expand Down
9 changes: 3 additions & 6 deletions Tests/Functional/Updates/TagSlugUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace T3G\AgencyPack\Blog\Tests\Functional\Updates;

use PHPUnit\Framework\Attributes\Test;
use T3G\AgencyPack\Blog\Updates\TagSlugUpdate;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

Expand All @@ -27,18 +28,14 @@ final class TagSlugUpdateTest extends FunctionalTestCase
'typo3conf/ext/blog'
];

/**
* @test
*/
#[Test]
public function noUpdateNecessaryTest(): void
{
$subject = new TagSlugUpdate();
self::assertFalse($subject->updateNecessary());
}

/**
* @test
*/
#[Test]
public function updateTest(): void
{
$subject = new TagSlugUpdate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace T3G\AgencyPack\Blog\Tests\Functional\ViewHelpers\Data;

use PHPUnit\Framework\Attributes\Test;
use T3G\AgencyPack\Blog\Constants;
use T3G\AgencyPack\Blog\Tests\Functional\SiteBasedTestCase;

Expand All @@ -20,9 +21,7 @@ final class ContentListOptionsViewHelperTest extends SiteBasedTestCase
'form'
];

/**
* @test
*/
#[Test]
public function render(): void
{
$this->createTestSite();
Expand All @@ -45,9 +44,7 @@ public function render(): void
);
}

/**
* @test
*/
#[Test]
public function renderWithOverwrite(): void
{
$this->createTestSite();
Expand Down
8 changes: 4 additions & 4 deletions Tests/Functional/ViewHelpers/GravatarViewHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace T3G\AgencyPack\Blog\Tests\Functional\ViewHelpers;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\Attributes\Test;
use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Core\TypoScript\AST\Node\RootNode;
Expand All @@ -30,10 +32,8 @@ final class GravatarViewHelperTest extends FunctionalTestCase
'typo3conf/ext/blog'
];

/**
* @test
* @dataProvider renderDataProvider
*/
#[Test]
#[DataProvider('renderDataProvider')]
public function render(string $template, string $expected): void
{
$frontendTypoScript = new FrontendTypoScript(new RootNode(), [], [], []);
Expand Down
Loading

0 comments on commit 4a8c0a2

Please sign in to comment.