From 8a9532a9f48ee18c30412fd305e0775c20ed99db Mon Sep 17 00:00:00 2001 From: Daniel Huf Date: Sun, 17 Aug 2025 22:50:19 +0200 Subject: [PATCH] feat: Add test to actions --- .github/workflows/ci.yaml | 27 +++++++++++++++++ .../Controller/UserimportControllerTest.php | 4 +-- composer.json | 1 + phpunit.xml.dist | 30 +++++++++++++++++++ 4 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 phpunit.xml.dist diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d840afa..15f48a3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -95,3 +95,30 @@ jobs: - name: Coding Guideline run: ./vendor/bin/ecs check + tests: + runs-on: ubuntu-latest + needs: + - xml-linting + - check-composer + strategy: + matrix: + include: + - php-version: '8.3' + typo3-version: '^13.4' + steps: + - uses: actions/checkout@v3 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: "${{ matrix.php-version }}" + coverage: none + tools: composer:v2 + env: + COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Install dependencies with expected TYPO3 version + run: composer require --no-progress --no-interaction --optimize-autoloader "typo3/cms-core:${{ matrix.typo3-version }}" + + - name: PHPUnit Tests + run: ./vendor/bin/phpunit --testdox diff --git a/Tests/Unit/Controller/UserimportControllerTest.php b/Tests/Unit/Controller/UserimportControllerTest.php index 6581deb..db4477b 100644 --- a/Tests/Unit/Controller/UserimportControllerTest.php +++ b/Tests/Unit/Controller/UserimportControllerTest.php @@ -15,7 +15,7 @@ class UserimportControllerTest extends UnitTestCase */ protected $subject; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->subject = $this->getMockBuilder(UserimportController::class) @@ -24,7 +24,7 @@ protected function setUp() ->getMock(); } - protected function tearDown() + protected function tearDown(): void { parent::tearDown(); } diff --git a/composer.json b/composer.json index e540890..bed1c8b 100644 --- a/composer.json +++ b/composer.json @@ -22,6 +22,7 @@ "phpoffice/phpspreadsheet": "^4" }, "require-dev": { + "typo3/testing-framework": "^9.0", "symplify/easy-coding-standard": "^12.4" }, "config": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..c2b1b47 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,30 @@ + + + + + + Tests/ + + + + + + Classes + + + + + + +