Skip to content

Commit

Permalink
Merge 9766917 into 91b8b90
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed Feb 23, 2021
2 parents 91b8b90 + 9766917 commit a810366
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 163 deletions.
139 changes: 0 additions & 139 deletions .circleci/config.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .coveralls.yml
@@ -0,0 +1,3 @@
service_name: github-actions
coverage_clover: Tests/reports/clover.xml
json_path: Tests/reports/coveralls.json
100 changes: 100 additions & 0 deletions .github/workflows/test-application.yaml
@@ -0,0 +1,100 @@
name: Test application

on:
pull_request:
push:
branches:
- '[0-9]+.x'
- '[0-9]+.[0-9]+'

jobs:
test:
name: 'PHP ${{ matrix.php-version }} (${{ matrix.dependency-versions }}, Lint ${{ matrix.lint }}, Coverage ${{ matrix.coverage }})'
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

strategy:
fail-fast: false
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

services:
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: root
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=5

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

- name: Install and configure PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ctype, iconv, mysql
coverage: pcov
tools: ${{ matrix.tools }}

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

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

- name: Execute test
if: matrix.coverage == false
run: composer test

- name: Execute test with coverage
if: ${{ matrix.coverage }}
run: composer test-with-coverage

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

- name: Coverage all upload
if: ${{ matrix.coverage }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls -vvv
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check coverage
if: ${{ matrix.coverage }}
run: composer check-coverage
4 changes: 2 additions & 2 deletions Content/Infrastructure/Doctrine/MetadataLoader.php
Expand Up @@ -14,7 +14,7 @@
namespace Sulu\Bundle\ContentBundle\Content\Infrastructure\Doctrine;

use Doctrine\Common\EventSubscriber;
use Doctrine\Common\Inflector\Inflector;
use Doctrine\Inflector\InflectorFactory;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;
use Doctrine\ORM\Events;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
Expand Down Expand Up @@ -196,7 +196,7 @@ private function addField(ClassMetadataInfo $metadata, string $name, string $typ

private function getRelationTableName(ClassMetadataInfo $metadata, string $relationName): string
{
$inflector = new Inflector();
$inflector = InflectorFactory::create()->build();
$tableNameParts = explode('_', $metadata->getTableName());
$singularName = $inflector->singularize($tableNameParts[\count($tableNameParts) - 1]) . '_';
$tableNameParts[\count($tableNameParts) - 1] = $singularName;
Expand Down
1 change: 1 addition & 0 deletions DependencyInjection/SuluContentExtension.php
Expand Up @@ -54,6 +54,7 @@ public function load(array $configs, ContainerBuilder $container): void
if ($container->hasParameter('kernel.bundles')) {
// TODO FIXME add test here
// @codeCoverageIgnoreStart
/** @var string[] $bundles */
$bundles = $container->getParameter('kernel.bundles');

if (\array_key_exists('SuluAutomationBundle', $bundles)) {
Expand Down
10 changes: 10 additions & 0 deletions Tests/Application/Kernel.php
Expand Up @@ -48,4 +48,14 @@ public function registerContainerConfiguration(LoaderInterface $loader)
parent::registerContainerConfiguration($loader);
$loader->load(__DIR__ . '/config/config_' . $this->getContext() . '.yml');
}

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

$gedmoReflection = new \ReflectionClass(\Gedmo\Exception::class);
$parameters['gedmo_directory'] = \dirname($gedmoReflection->getFileName());

return $parameters;
}
}
2 changes: 1 addition & 1 deletion Tests/Application/config/config.yml
Expand Up @@ -7,7 +7,7 @@ doctrine:
gedmo_tree:
type: xml
prefix: Gedmo\Tree\Entity
dir: "%kernel.project_dir%/../../vendor/gedmo/doctrine-extensions/lib/Gedmo/Tree/Entity"
dir: "%gedmo_directory%/Tree/Entity"
alias: GedmoTree
is_bundle: false

Expand Down
Expand Up @@ -13,8 +13,8 @@

namespace Sulu\Bundle\ContentBundle\Tests\Unit\Content\Infrastructure\Sulu\Automation;

use Doctrine\Common\Persistence\ObjectRepository;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ObjectRepository;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\Prophecy\ObjectProphecy;
Expand Down
Expand Up @@ -13,8 +13,8 @@

namespace Sulu\Bundle\ContentBundle\Tests\Unit\Content\Infrastructure\Sulu\Automation;

use Doctrine\Common\Persistence\ObjectRepository;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\Persistence\ObjectRepository;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\Prophecy\ObjectProphecy;
Expand Down
45 changes: 26 additions & 19 deletions composer.json
Expand Up @@ -11,27 +11,32 @@
"homepage": "https://github.com/sulu/SuluContentBundle",
"license": "MIT",
"require": {
"php": "^7.2",
"php": "^7.2 || ^8.0",
"doctrine/inflector": "^1.4.1 || ^2.0.1",
"doctrine/collections": "^1.0",
"doctrine/orm": "^2.5.3",
"doctrine/persistence": "^1.3 || ^2.0",
"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.0.4",
"symfony/config": "^4.3 || ^5.0",
"symfony/dependency-injection": "^4.3 || ^5.0",
"symfony/event-dispatcher": "^4.3 || ^5.0",
"symfony/http-foundation": "^4.3 || ^5.0",
"symfony/http-kernel": "^4.3 || ^5.0",
"symfony/options-resolver": "^4.3 || ^5.0",
"symfony/property-access": "^4.3 || ^5.0",
"symfony/security-core": "^4.3 || ^5.0",
"symfony/serializer": "^4.3 || ^5.0",
"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.3 || ^5.0",
"symfony/workflow": "^4.4 || ^5.0",
"webmozart/assert": "^1.3"
},
"require-dev": {
"coduo/php-matcher": "^3.2 || ^4.0 || ^5.0",
"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",
"handcraftedinthealps/code-coverage-checker": "^0.2.1",
Expand All @@ -40,20 +45,22 @@
"jangregor/phpstan-prophecy": "^0.8",
"matthiasnoback/symfony-config-test": "^4.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.0",
"php-coveralls/php-coveralls": "^2.4",
"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",
"sensiolabs-de/deptrac-shim": "^0.6.0",
"qossmic/deptrac-shim": "^0.11.1",
"sulu/automation-bundle": "^2.0@dev",
"symfony/browser-kit": "^4.3 || ^5.0",
"symfony/console": "^4.3 || ^5.0",
"symfony/debug": "^4.3",
"symfony/dotenv": "^4.3 || ^5.0",
"symfony/framework-bundle": "^4.3 || ^5.0",
"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/monolog-bundle": "^3.1",
"symfony/phpunit-bridge": "^5.2",
"symfony/string": "^4.4 || ^5.0",
"thecodingmachine/phpstan-strict-rules": "^0.12"
},
"conflict": {
Expand Down
File renamed without changes.

0 comments on commit a810366

Please sign in to comment.