Skip to content

Commit cd74c74

Browse files
committed
[TASK] Update test attributes
1 parent bfcf8fb commit cd74c74

20 files changed

+123
-329
lines changed

Build/php-cs-fixer/php-cs-fixer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@
134134
'spaces_inside_parentheses' => true,
135135
'type_declaration_spaces' => true,
136136
'types_spaces' => true,
137+
'php_unit_attributes' => true,
137138
\PhpCsFixerCustomFixers\Fixer\NoDuplicatedArrayKeyFixer::name() => true,
138139
\PhpCsFixerCustomFixers\Fixer\NoDuplicatedImportsFixer::name() => true,
139140
\PhpCsFixerCustomFixers\Fixer\NoPhpStormGeneratedCommentFixer::name() => true,

Tests/Functional/Repository/AddressRepositoryTest.php

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ public function setUp(): void
3333
$this->importCSVDataSet(__DIR__ . '/../Fixtures/tt_address.csv');
3434
}
3535

36-
/**
37-
* @test
38-
*/
36+
#[\PHPUnit\Framework\Attributes\Test]
3937
public function rawQueryReturnsCorrectQuery()
4038
{
4139
$demand = new Demand();
@@ -48,18 +46,14 @@ public function rawQueryReturnsCorrectQuery()
4846
self::assertEquals($sql, $result);
4947
}
5048

51-
/**
52-
* @test
53-
*/
49+
#[\PHPUnit\Framework\Attributes\Test]
5450
public function findRecordsByUid()
5551
{
5652
$address = $this->addressRepository->findByIdentifier(1);
5753
self::assertEquals('John', $address->getFirstName());
5854
}
5955

60-
/**
61-
* @test
62-
*/
56+
#[\PHPUnit\Framework\Attributes\Test]
6357
public function findRecordsByCustomSorting()
6458
{
6559
$demand = new Demand();
@@ -70,9 +64,7 @@ public function findRecordsByCustomSorting()
7064
self::assertEquals([3, 6, 2], $this->getListOfIds($addresses));
7165
}
7266

73-
/**
74-
* @test
75-
*/
67+
#[\PHPUnit\Framework\Attributes\Test]
7668
public function findRecordsByCustomSortingDesc()
7769
{
7870
$demand = new Demand();
@@ -85,9 +77,7 @@ public function findRecordsByCustomSortingDesc()
8577
self::assertEquals([2, 6, 3], $this->getListOfIds($addresses));
8678
}
8779

88-
/**
89-
* @test
90-
*/
80+
#[\PHPUnit\Framework\Attributes\Test]
9181
public function findRecordsByCustomSortingAndSortFieldDesc()
9282
{
9383
$demand = new Demand();
@@ -99,9 +89,7 @@ public function findRecordsByCustomSortingAndSortFieldDesc()
9989
self::assertEquals([3, 2, 6], $this->getListOfIds($addresses));
10090
}
10191

102-
/**
103-
* @test
104-
*/
92+
#[\PHPUnit\Framework\Attributes\Test]
10593
public function findRecordsByPageAndCustomSortingDesc()
10694
{
10795
$demand = new Demand();
@@ -112,9 +100,7 @@ public function findRecordsByPageAndCustomSortingDesc()
112100
self::assertEquals([7, 5, 6], $this->getListOfIds($addresses));
113101
}
114102

115-
/**
116-
* @test
117-
*/
103+
#[\PHPUnit\Framework\Attributes\Test]
118104
public function findRecordsByPageAndCustomSortingAsc()
119105
{
120106
$demand = new Demand();
@@ -124,9 +110,7 @@ public function findRecordsByPageAndCustomSortingAsc()
124110
self::assertEquals([6, 5, 7], $this->getListOfIds($addresses));
125111
}
126112

127-
/**
128-
* @test
129-
*/
113+
#[\PHPUnit\Framework\Attributes\Test]
130114
public function findRecordsByCategory()
131115
{
132116
$demand = new Demand();
@@ -145,9 +129,7 @@ public function findRecordsByCategory()
145129
self::assertEquals([2, 5, 6, 7], $this->getListOfIds($addresses));
146130
}
147131

148-
/**
149-
* @test
150-
*/
132+
#[\PHPUnit\Framework\Attributes\Test]
151133
public function findRecordsByCategoryWithSubCheck()
152134
{
153135
$demand = new Demand();
@@ -163,9 +145,7 @@ public function findRecordsByCategoryWithSubCheck()
163145
self::assertEquals([1, 6, 8], $this->getListOfIds($addresses));
164146
}
165147

166-
/**
167-
* @test
168-
*/
148+
#[\PHPUnit\Framework\Attributes\Test]
169149
public function findRecordsByCoordinates()
170150
{
171151
$demand = new Demand();

Tests/Functional/Service/CategoryServiceTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ public function setUp(): void
3131
$this->importCSVDataSet(__DIR__ . '/../Fixtures/sys_categories.csv');
3232
}
3333

34-
/**
35-
* @test
36-
*/
34+
#[\PHPUnit\Framework\Attributes\Test]
3735
public function findChildCategories()
3836
{
3937
$categories = $this->subject->getChildrenCategories('2,4');
@@ -43,9 +41,7 @@ public function findChildCategories()
4341
self::assertEquals('4,5,8', $categories);
4442
}
4543

46-
/**
47-
* @test
48-
*/
44+
#[\PHPUnit\Framework\Attributes\Test]
4945
public function loggerInvokedWithTooManyCategories()
5046
{
5147
$mockedTimeTracker = $this->getAccessibleMock(TimeTracker::class, ['setTSlogMessage'], [], '', false);

Tests/Functional/Service/GeocodeServiceTest.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ public function setUp(): void
2828
$this->importCSVDataSet(__DIR__ . '/../Fixtures/tt_address.csv');
2929
}
3030

31-
/**
32-
* @test
33-
*/
31+
#[\PHPUnit\Framework\Attributes\Test]
3432
public function properRecordsAreFound()
3533
{
3634
$subject = $this->getAccessibleMock(GeocodeService::class, ['getCoordinatesForAddress'], ['123']);
@@ -52,9 +50,7 @@ public function properRecordsAreFound()
5250
self::assertEquals(['latitude' => 10.000000000000, 'longitude' => 12.000000000000], ['latitude' => $row['latitude'], 'longitude' => $row['longitude']]);
5351
}
5452

55-
/**
56-
* @test
57-
*/
53+
#[\PHPUnit\Framework\Attributes\Test]
5854
public function urlforAddressesIsBuiltCorrectly()
5955
{
6056
$result1 = ['results' => [0 => ['geometry' => ['location' => ['lat' => 11, 'lng' => '13']]]]];
@@ -72,9 +68,7 @@ public function urlforAddressesIsBuiltCorrectly()
7268
self::assertEquals([], $response4);
7369
}
7470

75-
/**
76-
* @test
77-
*/
71+
#[\PHPUnit\Framework\Attributes\Test]
7872
public function findRecordsByUid()
7973
{
8074
self::assertTrue(true);

Tests/Unit/Command/GeocodeCommandTest.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,23 @@
1818

1919
class GeocodeCommandTest extends BaseTestCase
2020
{
21-
/**
22-
* @test
23-
*/
21+
#[\PHPUnit\Framework\Attributes\Test]
2422
public function configurationIsProperlyConfigured()
2523
{
2624
$subject = $this->getAccessibleMock(GeocodeCommand::class, ['addArgument'], [], '', false);
2725
$subject->_call('configure');
2826
self::assertEquals('Geocode tt_address records', $subject->getDescription());
2927
}
3028

31-
/**
32-
* @test
33-
*/
29+
#[\PHPUnit\Framework\Attributes\Test]
3430
public function geocodeServiceIsReturned()
3531
{
3632
$subject = $this->getAccessibleMock(GeocodeCommand::class, null, [], '', false);
3733
$service = $subject->_call('getGeocodeService', '123');
3834
self::assertInstanceOf(GeocodeService::class, $service);
3935
}
4036

41-
/**
42-
* @test
43-
*/
37+
#[\PHPUnit\Framework\Attributes\Test]
4438
public function geocodingIsCalled()
4539
{
4640
$geocodeService = $this->getAccessibleMock(GeocodeService::class, ['calculateCoordinatesForAllRecordsInTable'], [], '', false);

Tests/Unit/Controller/AddressControllerPaginationTest.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,18 @@
1313
use FriendsOfTYPO3\TtAddress\Domain\Model\Dto\Demand;
1414
use FriendsOfTYPO3\TtAddress\Domain\Model\Dto\Settings;
1515
use FriendsOfTYPO3\TtAddress\Domain\Repository\AddressRepository;
16+
use PHPUnit\Framework\Attributes\Test;
1617
use TYPO3\CMS\Core\Information\Typo3Version;
1718
use TYPO3\CMS\Core\Pagination\PaginatorInterface;
1819
use TYPO3\CMS\Core\Pagination\SimplePagination;
1920
use TYPO3\CMS\Extbase\Mvc\Request;
2021
use TYPO3\CMS\Fluid\View\FluidViewAdapter;
2122
use TYPO3\CMS\Fluid\View\TemplateView;
22-
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
2323
use TYPO3\TestingFramework\Core\BaseTestCase;
2424

2525
class AddressControllerPaginationTest extends BaseTestCase
2626
{
27-
28-
/**
29-
* @test
30-
*/
27+
#[Test]
3128
public function listActionUsesNewPaginationWithArrayRecords()
3229
{
3330
if (!class_exists(SimplePagination::class)) {
@@ -80,9 +77,7 @@ public function listActionUsesNewPaginationWithArrayRecords()
8077
$subject->listAction();
8178
}
8279

83-
/**
84-
* @test
85-
*/
80+
#[\PHPUnit\Framework\Attributes\Test]
8681
public function paginationIsCorrectlyTriggered()
8782
{
8883
if (!class_exists(SimplePagination::class)) {

Tests/Unit/Controller/AddressControllerTest.php

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,8 @@ protected function setUp(): void
4242
$GLOBALS['TYPO3_REQUEST'] = $serverRequest;
4343
}
4444

45-
/**
46-
* @test
47-
* @dataProvider dotIsRemovedFromEndDataProvider
48-
*/
45+
#[\PHPUnit\Framework\Attributes\Test]
46+
#[\PHPUnit\Framework\Attributes\DataProvider('dotIsRemovedFromEndDataProvider')]
4947
public function dotIsRemovedFromEnd($given, $expected)
5048
{
5149
$subject = $this->getAccessibleMock(AddressController::class, null, [], '', false);
@@ -60,9 +58,7 @@ public static function dotIsRemovedFromEndDataProvider(): array
6058
];
6159
}
6260

63-
/**
64-
* @test
65-
*/
61+
#[\PHPUnit\Framework\Attributes\Test]
6662
public function dotsAreRemovedFromArray()
6763
{
6864
$subject = $this->getAccessibleMock(AddressController::class, null, [], '', false);
@@ -87,9 +83,7 @@ public function dotsAreRemovedFromArray()
8783
self::assertEquals($expected, $subject->_call('removeDots', $given));
8884
}
8985

90-
/**
91-
* @test
92-
*/
86+
#[\PHPUnit\Framework\Attributes\Test]
9387
public function injectAddressRepositoryWorks()
9488
{
9589
$mockedRepository = $this->getAccessibleMock(AddressRepository::class, null, [], '', false);
@@ -100,9 +94,7 @@ public function injectAddressRepositoryWorks()
10094
self::assertEquals($mockedRepository, $subject->_get('addressRepository'));
10195
}
10296

103-
/**
104-
* @test
105-
*/
97+
#[\PHPUnit\Framework\Attributes\Test]
10698
public function pidListIsReturned()
10799
{
108100
$mockedPageRepsitory = $this->getAccessibleMock(PageRepository::class, ['getPageIdsRecursive'], [], '', false);
@@ -121,9 +113,7 @@ public function pidListIsReturned()
121113
self::assertEquals([123, 456, 789], $subject->_call('getPidList'));
122114
}
123115

124-
/**
125-
* @test
126-
*/
116+
#[\PHPUnit\Framework\Attributes\Test]
127117
public function settingsAreProperlyInjected()
128118
{
129119
self::markTestSkipped('Skipped until fixed');
@@ -167,9 +157,7 @@ public function settingsAreProperlyInjected()
167157
self::assertEquals($expectedSettings, $subject->_get('settings'));
168158
}
169159

170-
/**
171-
* @test
172-
*/
160+
#[\PHPUnit\Framework\Attributes\Test]
173161
public function demandIsCreated()
174162
{
175163
$demand = new Demand();
@@ -193,9 +181,7 @@ public function demandIsCreated()
193181
self::assertEquals($expected, $subject->_call('createDemandFromSettings'));
194182
}
195183

196-
/**
197-
* @test
198-
*/
184+
#[\PHPUnit\Framework\Attributes\Test]
199185
public function showActionFillsView()
200186
{
201187
$address = new Address();
@@ -216,9 +202,7 @@ public function showActionFillsView()
216202
$subject->showAction($address);
217203
}
218204

219-
/**
220-
* @test
221-
*/
205+
#[\PHPUnit\Framework\Attributes\Test]
222206
public function listActionFillsViewForSingleRecords()
223207
{
224208
$settings = [
@@ -254,9 +238,7 @@ public function listActionFillsViewForSingleRecords()
254238
$subject->listAction();
255239
}
256240

257-
/**
258-
* @test
259-
*/
241+
#[\PHPUnit\Framework\Attributes\Test]
260242
public function listActionFillsViewForDemand()
261243
{
262244
$settings = [
@@ -292,9 +274,7 @@ public function listActionFillsViewForDemand()
292274
$subject->listAction();
293275
}
294276

295-
/**
296-
* @test
297-
*/
277+
#[\PHPUnit\Framework\Attributes\Test]
298278
public function overrideDemandMethodIsCalledIfEnabled()
299279
{
300280
$mockedRequest = $this->getAccessibleMock(Request::class, ['hasArgument', 'getArgument', 'getAttribute'], [], '', false);
@@ -335,10 +315,8 @@ public function overrideDemandMethodIsCalledIfEnabled()
335315
$subject->listAction(['not', 'empty']);
336316
}
337317

338-
/**
339-
* @test
340-
* @dataProvider overrideDemandWorksDataProvider
341-
*/
318+
#[\PHPUnit\Framework\Attributes\Test]
319+
#[\PHPUnit\Framework\Attributes\DataProvider('overrideDemandWorksDataProvider')]
342320
public function overrideDemandWorks(Demand $demandIn, Demand $demandOut, array $override)
343321
{
344322
$subject = $this->getAccessibleMock(AddressController::class, null, [], '', false);

0 commit comments

Comments
 (0)