Skip to content

Commit

Permalink
Merge 2ffca0c into 91b8b90
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-schranz committed Feb 19, 2021
2 parents 91b8b90 + 2ffca0c commit 460d67c
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 147 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
111 changes: 111 additions & 0 deletions .github/workflows/test-application.yaml
@@ -0,0 +1,111 @@
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'
composer-options: '--ignore-platform-reqs'
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: Install Coverage all
if: ${{ matrix.coverage }}
run: |
composer require --dev php-coveralls/php-coveralls
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.1.0/php-coveralls.phar
chmod +x php-coveralls.phar
./php-coveralls.phar --version
- name: Coverage all upload
if: ${{ matrix.coverage }}
run: |
export COVERALLS_REPO_TOKEN=Oa0R2jn3DOKzycfdtvhZKBxgFcRufVPFo
export COVERALLS_RUN_LOCALLY=1
./php-coveralls.phar -c .coveralls.yml -vvv
#env:
# COVERALLS_RUN_LOCALLY: 1
# COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_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
13 changes: 10 additions & 3 deletions composer.json
Expand Up @@ -11,12 +11,16 @@
"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",
"sulu/sulu": "^2.0.4 || ^2.3@dev",
"symfony/config": "^4.3 || ^5.0",
"symfony/dependency-injection": "^4.3 || ^5.0",
"symfony/event-dispatcher": "^4.3 || ^5.0",
Expand All @@ -31,7 +35,8 @@
"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,6 +45,7 @@
"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",
Expand All @@ -54,6 +60,7 @@
"symfony/framework-bundle": "^4.3 || ^5.0",
"symfony/monolog-bundle": "^3.1",
"symfony/phpunit-bridge": "^5.2",
"symfony/string": "^4.3 || ^5.0",
"thecodingmachine/phpstan-strict-rules": "^0.12"
},
"conflict": {
Expand Down

0 comments on commit 460d67c

Please sign in to comment.