Skip to content

Commit

Permalink
Merge eda730f into bbe3c44
Browse files Browse the repository at this point in the history
  • Loading branch information
mario-fehr committed Oct 3, 2022
2 parents bbe3c44 + eda730f commit 9cccc20
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 42 deletions.
46 changes: 37 additions & 9 deletions .github/workflows/test-application.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
test:
name: 'PHP ${{ matrix.php-version }} (${{ matrix.dependency-versions }}, Lint ${{ matrix.lint }}, Coverage ${{ matrix.coverage }})'
name: 'PHP ${{ matrix.php-version }} (${{ matrix.dependency-versions }}, Coverage ${{ matrix.coverage }})'
runs-on: ubuntu-latest

env:
Expand All @@ -22,29 +22,32 @@ jobs:
matrix:
include:
- php-version: '7.2'
lint: false
coverage: false
dependency-versions: 'lowest'
tools: 'composer:v1'
env:
SYMFONY_DEPRECATIONS_HELPER: disabled

- php-version: '7.4'
lint: true
coverage: true
dependency-versions: 'highest'
tools: 'composer:v2'
env:
SYMFONY_DEPRECATIONS_HELPER: weak

- php-version: '8.0'
lint: false
coverage: false
dependency-versions: 'highest'
tools: 'composer:v2'
env:
SYMFONY_DEPRECATIONS_HELPER: weak

- php-version: '8.1'
coverage: false
dependency-versions: 'highest'
env:
SYMFONY_DEPRECATIONS_HELPER: weak

services:
mysql:
image: mysql:5.7
Expand All @@ -67,18 +70,14 @@ jobs:
tools: ${{ matrix.tools }}

- name: Install composer dependencies
uses: ramsey/composer-install@v1
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dependency-versions }}
composer-options: ${{ matrix.composer-options }}

- name: Bootstrap test environment
run: composer bootstrap-test-environment

- name: Lint Code
if: ${{ matrix.lint }}
run: composer lint

- name: Execute test cases
if: matrix.coverage == false
run: composer test
Expand All @@ -98,3 +97,32 @@ jobs:
- name: Check code coverage
if: ${{ matrix.coverage }}
run: composer check-coverage

lint:
name: 'PHP Lint'
runs-on: ubuntu-latest

env:
DATABASE_URL: mysql://root:root@127.0.0.1:3306/su_headless_test?serverVersion=5.7
DATABASE_CHARSET: utf8mb4
DATABASE_COLLATE: utf8mb4_unicode_ci

steps:
- name: Checkout project
uses: actions/checkout@v2

- name: Install and configure PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: ctype, iconv, mysql
tools: 'composer:v2'

- name: Install composer dependencies
uses: ramsey/composer-install@v2
with:
dependency-versions: 'highest'

- name: Lint Code
if: ${{ matrix.lint }}
run: composer lint
4 changes: 2 additions & 2 deletions Tests/Application/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

class Kernel extends SuluTestKernel
{
public function registerBundles()
public function registerBundles(): iterable
{
$bundles = parent::registerBundles();
$bundles[] = new SuluContentBundle();
Expand All @@ -49,7 +49,7 @@ public function registerContainerConfiguration(LoaderInterface $loader)
$loader->load(__DIR__ . '/config/config_' . $this->getContext() . '.yml');
}

protected function getKernelParameters()
protected function getKernelParameters(): array
{
$parameters = parent::getKernelParameters();

Expand Down
4 changes: 2 additions & 2 deletions Tests/Application/config/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
swiftmailer:
disable_delivery: true
framework:
profiler: { enabled: true, collect: false }

doctrine:
orm:
Expand Down
2 changes: 1 addition & 1 deletion Tests/Application/config/routing_admin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# FosJsRoutingBundle
fos_js_routing:
prefix: /admin
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing.xml"
resource: "@FOSJsRoutingBundle/Resources/config/routing/routing-sf4.xml"

# Sulu
sulu_tag_api:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ protected function setUp(): void

public function createCategoryFactory(): CategoryFactoryInterface
{
return self::$container->get('sulu_content.category_factory');
return self::getContainer()->get('sulu_content.category_factory');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected function setUp(): void

public function createContentDimensionRepository(): DimensionContentRepositoryInterface
{
return self::$container->get('sulu_content.dimension_content_repository');
return self::getContainer()->get('sulu_content.dimension_content_repository');
}

public function testLoadExistAll(): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ protected function setUp(): void
self::bootKernel();
self::purgeDatabase();

$this->tagFactory = self::$container->get('sulu_content.tag_factory');
$this->tagFactory = self::getContainer()->get('sulu_content.tag_factory');
}

/**
Expand Down Expand Up @@ -72,7 +72,7 @@ public function testCreateSameTagTwiceWithOtherEntityInUnitOfWork(): void
$this->getEntityManager()->persist($this->createOtherEntity());

/** @var TagRepositoryInterface $tagRepository */
$tagRepository = self::$container->get('sulu.repository.tag');
$tagRepository = self::getContainer()->get('sulu.repository.tag');
$tag = $tagRepository->createNew();
$tag->setName('Other Tag');
$this->getEntityManager()->persist($tag);
Expand Down Expand Up @@ -138,7 +138,7 @@ public function dataProvider(): \Generator
private function createTags(array $existTagNames = []): void
{
/** @var TagRepositoryInterface $tagRepository */
$tagRepository = self::$container->get('sulu.repository.tag');
$tagRepository = self::getContainer()->get('sulu.repository.tag');

foreach ($existTagNames as $existTagName) {
$existTag = $tagRepository->createNew();
Expand Down
45 changes: 22 additions & 23 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,47 +19,47 @@
"doctrine/doctrine-bundle": "^1.10 || ^2.0",
"friendsofsymfony/rest-bundle": "^2.6 || ^3.0",
"massive/search-bundle": "^2.4",
"ramsey/uuid": "^3.8",
"sulu/sulu": "^2.1 || ^2.3@dev",
"symfony/config": "^4.4 || ^5.0",
"symfony/dependency-injection": "^4.4 || ^5.0",
"symfony/event-dispatcher": "^4.4 || ^5.0",
"symfony/http-foundation": "^4.4 || ^5.0",
"symfony/http-kernel": "^4.4 || ^5.0",
"symfony/options-resolver": "^4.4 || ^5.0",
"symfony/property-access": "^4.4 || ^5.0",
"symfony/security-core": "^4.4 || ^5.0",
"symfony/serializer": "^4.4 || ^5.0",
"symfony/translation-contracts": "^1.0 || ^2.0",
"symfony/workflow": "^4.4 || ^5.0",
"ramsey/uuid": "^3.8 || ^4.0",
"sulu/sulu": "^2.1 || ^2.6@dev",
"symfony/config": "^4.4 || ^5.4 || ^6.0",
"symfony/dependency-injection": "^4.4 || ^5.4 || ^6.0",
"symfony/event-dispatcher": "^4.4 || ^5.4 || ^6.0",
"symfony/http-foundation": "^4.4 || ^5.4 || ^6.0",
"symfony/http-kernel": "^4.4 || ^5.4 || ^6.0",
"symfony/options-resolver": "^4.4 || ^5.4 || ^6.0",
"symfony/property-access": "^4.4 || ^5.4 || ^6.0",
"symfony/security-core": "^4.4 || ^5.4 || ^6.0",
"symfony/serializer": "^4.4 || ^5.4 || ^6.0",
"symfony/translation-contracts": "^1.0 || ^2.0 || ^3.0",
"symfony/workflow": "^4.4 || ^5.4 || ^6.0",
"webmozart/assert": "^1.3"
},
"require-dev": {
"coduo/php-matcher": "^3.2 || ^4.0 || ^5.0 || ^6.0",
"doctrine/data-fixtures": "^1.3.3",
"doctrine/doctrine-fixtures-bundle": "^2.0 || ^3.0",
"friendsofphp/php-cs-fixer": "^2.17",
"friendsofphp/php-cs-fixer": "^2.17 || ^3.0",
"handcraftedinthealps/code-coverage-checker": "^0.2.1",
"handcraftedinthealps/zendsearch": "^2.0",
"jackalope/jackalope-doctrine-dbal": "^1.3.4",
"jangregor/phpstan-prophecy": "^0.8",
"matthiasnoback/symfony-config-test": "^4.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.0",
"phpspec/prophecy": "^1.14",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-doctrine": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpstan/phpstan-symfony": "^0.12",
"phpstan/phpstan-webmozart-assert": "^0.12",
"qossmic/deptrac-shim": "^0.11.1",
"qossmic/deptrac-shim": "^0.11.1 || ^0.23.0",
"sulu/automation-bundle": "^2.0@dev",
"symfony/browser-kit": "^4.4 || ^5.0",
"symfony/console": "^4.4 || ^5.0",
"symfony/debug": "^4.4",
"symfony/dotenv": "^4.4 || ^5.0",
"symfony/framework-bundle": "^4.4 || ^5.0",
"symfony/browser-kit": "^4.4 || ^5.4 || ^6.0",
"symfony/console": "^4.4 || ^5.4 || ^6.0",
"symfony/dotenv": "^4.4 || ^5.4 || ^6.0",
"symfony/framework-bundle": "^4.4 || ^5.4 || ^6.0",
"symfony/monolog-bundle": "^3.1",
"symfony/phpunit-bridge": "^5.2",
"symfony/string": "^4.4 || ^5.0",
"symfony/phpunit-bridge": "^5.4 || ^6.0",
"symfony/string": "^4.4 || ^5.4 || ^6.0",
"thecodingmachine/phpstan-strict-rules": "^0.12"
},
"conflict": {
Expand Down Expand Up @@ -106,7 +106,6 @@
"check-coverage": [
"@php vendor/bin/code-coverage-checker \"Tests/reports/coverage.php\" \"line\" \"100.00\" \"Content\" \"DependencyInjection\""
],
"deptract": "vendor/bin/deptrac",
"phpstan": [
"Tests/Application/bin/adminconsole cache:warmup --env dev",
"@test install",
Expand Down
4 changes: 4 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@
</exclude>
</whitelist>
</filter>

<listeners>
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener" />
</listeners>
</phpunit>

0 comments on commit 9cccc20

Please sign in to comment.