Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .github/workflows/core14.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: core 14

on: [ push, pull_request ]

jobs:
tests:
name: v14
runs-on: ubuntu-22.04
strategy:
# This prevents cancellation of matrix job runs, if one/two already failed and let the
# rest matrix jobs be executed anyway.
fail-fast: true
matrix:
php: [ '8.2', '8.3', '8.4' ]
composerInstall: [ 'composerInstallLowest', 'composerInstallHighest' ]
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install testing system
run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -s ${{ matrix.composerInstall }}

- name: Lint PHP
run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -s lint

- if: matrix.php == '8.3'
name: Validate code against CGL
run: PHP_CS_FIXER_IGNORE_ENV=1 Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -s cgl -n

- name: Unit Tests
run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -s unit

# - name: Functional Tests with mariadb and mysqli
# run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mariadb -a mysqli -s functional
#
# - name: Functional Tests with mariadb and pdo_mysql
# run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mariadb -a pdo_mysql -s functional
#
# - name: Functional Tests with mysql and mysqli
# run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mysql -a mysqli -s functional
#
# - name: Functional Tests with mysql and pdo_mysql
# run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d mysql -a pdo_mysql -s functional
#
# - name: Functional Tests with postgres
# run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d postgres -s functional

# @todo disabled, due cross dbmns issues in code. Should be fixed first
# - name: Functional Tests with sqlite
# run: Build/Scripts/runTests.sh -t 14 -p ${{ matrix.php }} -d sqlite -s functional
29 changes: 24 additions & 5 deletions Build/Scripts/runTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,14 @@ Options:
- 15 maintained until 2027-11-11
- 16 maintained until 2028-11-09

-t <12|13>
-t <12|13|14>
Only with -s composerInstall|composerInstallMin|composerInstallMax
Specifies the TYPO3 CORE Version to be used
- 12: use TYPO3 v12 (default)
- 13: use TYPO3 v13
- 14: use TYPO3 v14

-p <8.0|8.1|8.2|8.3|8.4>
-p <8.2|8.3|8.4>
Specifies the PHP minor version to be used
- 8.0: use PHP 8.0 (default)
- 8.1: use PHP 8.1
Expand Down Expand Up @@ -307,7 +308,7 @@ ROOT_DIR="${PWD}"

# Option defaults
TEST_SUITE=""
TYPO3_VERSION="12"
TYPO3_VERSION="13"
DBMS="mysql"
DBMS_VERSION=""
PHP_VERSION="8.2"
Expand Down Expand Up @@ -366,7 +367,7 @@ while getopts "a:b:s:d:i:p:e:t:xy:nhu" OPT; do
;;
t)
TYPO3_VERSION=${OPTARG}
if ! [[ ${TYPO3_VERSION} =~ ^(12|13)$ ]]; then
if ! [[ ${TYPO3_VERSION} =~ ^(12|13|14)$ ]]; then
INVALID_OPTIONS+=("-t ${OPTARG}")
fi
;;
Expand Down Expand Up @@ -512,6 +513,15 @@ case ${TEST_SUITE} in
composer require --no-ansi --no-interaction --no-progress --no-install \
typo3/cms-core:^13.4 || exit 1
fi
if [ ${TYPO3_VERSION} -eq 14 ]; then
composer config minimum-stability dev
composer require --no-ansi --no-interaction --no-progress --no-install \
typo3/cms-core:dev-main \
typo3/cms-install:dev-main \
typo3/testing-framework:dev-main \
phpunit/phpunit:^11.5.44 \
|| exit 1
fi
composer update --no-progress --no-interaction || exit 1
composer show || exit 1
"
Expand All @@ -528,7 +538,16 @@ case ${TEST_SUITE} in
fi
if [ ${TYPO3_VERSION} -eq 13 ]; then
composer require --no-ansi --no-interaction --no-progress --no-install \
typo3/cms-core:^13.4 || exit 1
typo3/cms-core:^13.4.17 || exit 1
fi
if [ ${TYPO3_VERSION} -eq 14 ]; then
composer config minimum-stability dev
composer require --no-ansi --no-interaction --no-progress --no-install \
typo3/cms-core:dev-main \
typo3/cms-install:dev-main \
typo3/testing-framework:dev-main \
phpunit/phpunit:^11.5.44 \
|| exit 1
fi
composer update --no-ansi --no-interaction --no-progress --with-dependencies --prefer-lowest || exit 1
composer show || exit 1
Expand Down
3 changes: 2 additions & 1 deletion Build/php-cs-fixer/php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
'class_attributes_separation' => ['elements' => ['method' => 'one']],
'class_definition' => true,
'single_class_element_per_statement' => true,
'visibility_required' => true,
'modifier_keywords' => ['elements' => ['const', 'method', 'property']],
'multiline_comment_opening_closing' => true,
'no_empty_comment' => true,
'single_line_comment_spacing' => true,
Expand Down Expand Up @@ -134,6 +134,7 @@
'spaces_inside_parentheses' => true,
'type_declaration_spaces' => true,
'types_spaces' => true,
'php_unit_attributes' => true,
\PhpCsFixerCustomFixers\Fixer\NoDuplicatedArrayKeyFixer::name() => true,
\PhpCsFixerCustomFixers\Fixer\NoDuplicatedImportsFixer::name() => true,
\PhpCsFixerCustomFixers\Fixer\NoPhpStormGeneratedCommentFixer::name() => true,
Expand Down
40 changes: 10 additions & 30 deletions Tests/Functional/Repository/AddressRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ public function setUp(): void
$this->importCSVDataSet(__DIR__ . '/../Fixtures/tt_address.csv');
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function rawQueryReturnsCorrectQuery()
{
$demand = new Demand();
Expand All @@ -48,18 +46,14 @@ public function rawQueryReturnsCorrectQuery()
self::assertEquals($sql, $result);
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function findRecordsByUid()
{
$address = $this->addressRepository->findByIdentifier(1);
self::assertEquals('John', $address->getFirstName());
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function findRecordsByCustomSorting()
{
$demand = new Demand();
Expand All @@ -70,9 +64,7 @@ public function findRecordsByCustomSorting()
self::assertEquals([3, 6, 2], $this->getListOfIds($addresses));
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function findRecordsByCustomSortingDesc()
{
$demand = new Demand();
Expand All @@ -85,9 +77,7 @@ public function findRecordsByCustomSortingDesc()
self::assertEquals([2, 6, 3], $this->getListOfIds($addresses));
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function findRecordsByCustomSortingAndSortFieldDesc()
{
$demand = new Demand();
Expand All @@ -99,9 +89,7 @@ public function findRecordsByCustomSortingAndSortFieldDesc()
self::assertEquals([3, 2, 6], $this->getListOfIds($addresses));
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function findRecordsByPageAndCustomSortingDesc()
{
$demand = new Demand();
Expand All @@ -112,9 +100,7 @@ public function findRecordsByPageAndCustomSortingDesc()
self::assertEquals([7, 5, 6], $this->getListOfIds($addresses));
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function findRecordsByPageAndCustomSortingAsc()
{
$demand = new Demand();
Expand All @@ -124,9 +110,7 @@ public function findRecordsByPageAndCustomSortingAsc()
self::assertEquals([6, 5, 7], $this->getListOfIds($addresses));
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function findRecordsByCategory()
{
$demand = new Demand();
Expand All @@ -145,9 +129,7 @@ public function findRecordsByCategory()
self::assertEquals([2, 5, 6, 7], $this->getListOfIds($addresses));
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function findRecordsByCategoryWithSubCheck()
{
$demand = new Demand();
Expand All @@ -163,9 +145,7 @@ public function findRecordsByCategoryWithSubCheck()
self::assertEquals([1, 6, 8], $this->getListOfIds($addresses));
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function findRecordsByCoordinates()
{
$demand = new Demand();
Expand Down
8 changes: 2 additions & 6 deletions Tests/Functional/Service/CategoryServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ public function setUp(): void
$this->importCSVDataSet(__DIR__ . '/../Fixtures/sys_categories.csv');
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function findChildCategories()
{
$categories = $this->subject->getChildrenCategories('2,4');
Expand All @@ -43,9 +41,7 @@ public function findChildCategories()
self::assertEquals('4,5,8', $categories);
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function loggerInvokedWithTooManyCategories()
{
$mockedTimeTracker = $this->getAccessibleMock(TimeTracker::class, ['setTSlogMessage'], [], '', false);
Expand Down
12 changes: 3 additions & 9 deletions Tests/Functional/Service/GeocodeServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@ public function setUp(): void
$this->importCSVDataSet(__DIR__ . '/../Fixtures/tt_address.csv');
}

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

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function urlforAddressesIsBuiltCorrectly()
{
$result1 = ['results' => [0 => ['geometry' => ['location' => ['lat' => 11, 'lng' => '13']]]]];
Expand All @@ -72,9 +68,7 @@ public function urlforAddressesIsBuiltCorrectly()
self::assertEquals([], $response4);
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function findRecordsByUid()
{
self::assertTrue(true);
Expand Down
12 changes: 3 additions & 9 deletions Tests/Unit/Command/GeocodeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,23 @@

class GeocodeCommandTest extends BaseTestCase
{
/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function configurationIsProperlyConfigured()
{
$subject = $this->getAccessibleMock(GeocodeCommand::class, ['addArgument'], [], '', false);
$subject->_call('configure');
self::assertEquals('Geocode tt_address records', $subject->getDescription());
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function geocodeServiceIsReturned()
{
$subject = $this->getAccessibleMock(GeocodeCommand::class, null, [], '', false);
$service = $subject->_call('getGeocodeService', '123');
self::assertInstanceOf(GeocodeService::class, $service);
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function geocodingIsCalled()
{
$geocodeService = $this->getAccessibleMock(GeocodeService::class, ['calculateCoordinatesForAllRecordsInTable'], [], '', false);
Expand Down
19 changes: 6 additions & 13 deletions Tests/Unit/Controller/AddressControllerPaginationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,18 @@
use FriendsOfTYPO3\TtAddress\Domain\Model\Dto\Demand;
use FriendsOfTYPO3\TtAddress\Domain\Model\Dto\Settings;
use FriendsOfTYPO3\TtAddress\Domain\Repository\AddressRepository;
use PHPUnit\Framework\Attributes\Test;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Pagination\PaginatorInterface;
use TYPO3\CMS\Core\Pagination\SimplePagination;
use TYPO3\CMS\Extbase\Mvc\Request;
use TYPO3\CMS\Fluid\View\FluidViewAdapter;
use TYPO3\CMS\Fluid\View\TemplateView;
use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
use TYPO3\TestingFramework\Core\BaseTestCase;

class AddressControllerPaginationTest extends BaseTestCase
{
protected function setUp(): void
{
$GLOBALS['TSFE'] = $this->getAccessibleMock(TypoScriptFrontendController::class, ['addCacheTags'], [], '', false);
}

/**
* @test
*/
#[Test]
public function listActionUsesNewPaginationWithArrayRecords()
{
if (!class_exists(SimplePagination::class)) {
Expand Down Expand Up @@ -67,7 +62,7 @@ public function listActionUsesNewPaginationWithArrayRecords()
$mockedRequest->expects(self::once())->method('getArgument')->with('currentPage')->willReturn(2);
$mockedRequest->expects(self::any())->method('getAttribute')->willReturn([]);

$mockedView = $this->getAccessibleMock(TemplateView::class, ['assignMultiple', 'assign'], [], '', false);
$mockedView = $this->getAccessibleMock((new Typo3Version())->getMajorVersion() >= 14 ? FluidViewAdapter::class : TemplateView::class, ['assignMultiple', 'assign'], [], '', false);
$mockedView->expects(self::once())->method('assignMultiple')->with($assignments);

$subject = $this->getAccessibleMock(AddressController::class, ['createDemandFromSettings', 'htmlResponse'], [], '', false);
Expand All @@ -82,9 +77,7 @@ public function listActionUsesNewPaginationWithArrayRecords()
$subject->listAction();
}

/**
* @test
*/
#[\PHPUnit\Framework\Attributes\Test]
public function paginationIsCorrectlyTriggered()
{
if (!class_exists(SimplePagination::class)) {
Expand Down
Loading