Skip to content

Commit

Permalink
[TASK] Use Test attribute in functional test examples (TYPO3-Document…
Browse files Browse the repository at this point in the history
…ation#4794)

typo3/testing-framwork in version 8.2 is used with TYPO3 v13. It requires
as least PHPUnit v10 which provides the `#[Test]` attribute. Therefore,
this attribute is used instead of the `@test` annotation.

Releases: main
  • Loading branch information
brotkrueml authored Oct 1, 2024
1 parent 6db5048 commit 4896691
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

namespace TYPO3\CMS\Styleguide\Tests\Functional\TcaDataGenerator;

use PHPUnit\Framework\Attributes\Test;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

/**
* Test case
*/
class GeneratorTest extends FunctionalTestCase
{
/**
Expand All @@ -16,10 +14,8 @@ class GeneratorTest extends FunctionalTestCase
'typo3conf/ext/styleguide',
];

/**
* @test
*/
public function generatorCreatesBasicRecord()
#[Test]
public function generatorCreatesBasicRecord(): void
{
//...
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace MyVendor\MyExtension\Tests\Functional;

use PHPUnit\Framework\Attributes\Test;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

class SomeTest extends FunctionalTestCase
Expand All @@ -12,9 +13,7 @@ class SomeTest extends FunctionalTestCase
'workspaces',
];

/**
* @test
*/
#[Test]
public function somethingWithWorkspaces(): void
{
//...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace MyVendor\MyExtension\Tests\Functional;

use PHPUnit\Framework\Attributes\Test;
use Symfony\Component\Mailer\Transport\NullTransport;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

Expand All @@ -15,9 +16,7 @@ class SomeTest extends FunctionalTestCase
],
];

/**
* @test
*/
#[Test]
public function something(): void
{
//...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace MyVendor\MyExtension\Tests\Functional;

use PHPUnit\Framework\Attributes\Test;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

class SomeTest extends FunctionalTestCase
Expand All @@ -13,9 +14,7 @@ class SomeTest extends FunctionalTestCase
'typo3conf/ext/base_extension',
];

/**
* @test
*/
#[Test]
public function somethingWithExtensions(): void
{
//...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace MyVendor\MyExtension\Tests\Functional;

use PHPUnit\Framework\Attributes\Test;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

class SomeTest extends FunctionalTestCase
Expand All @@ -12,9 +13,7 @@ class SomeTest extends FunctionalTestCase
'typo3/sysext/impexp/Tests/Functional/Fixtures/Folders/fileadmin/user_upload/typo3_image2.jpg' => 'fileadmin/user_upload/typo3_image2.jpg',
];

/**
* @test
*/
#[Test]
public function somethingWithFiles(): void
{
//...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

namespace MyVendor\MyExtension\Tests\Functional;

use PHPUnit\Framework\Attributes\Test;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

class SomeTest extends FunctionalTestCase
{
/**
* @test
*/
#[Test]
public function somethingWithWorkspaces(): void
{
$this->setUpFrontendRootPage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@

namespace MyVendor\MyExtension\Tests\Functional;

use PHPUnit\Framework\Attributes\Test;
use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;

/**
* Test case
*/
class SomeTest extends FunctionalTestCase
{
public function testSomething()
#[Test]
public function importData(): void
{
// Load a xml file relative to test case file
// Load a CSV file relative to test case file
$this->importCSVDataSet(__DIR__ . '/../Fixtures/pages.csv');
// Load a xml file of some extension
// Load a CSV file of some extension
$this->importCSVDataSet('EXT:frontend/Tests/Functional/Fixtures/pages-title-tag.csv');
// Load a xml file provided by the typo3/testing-framework package
// Load a CSV file provided by the typo3/testing-framework package
$this->importCSVDataSet('PACKAGE:typo3/testing-framework/Resources/Core/Functional/Fixtures/pages.csv');
}
}

0 comments on commit 4896691

Please sign in to comment.