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
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ jobs:
-
name: Prepare test application
run: |
(cd src/Bundle/test && app/console doctrine:database:create)
(cd src/Bundle/test && app/console doctrine:schema:create)
(cd src/Bundle/test && bin/console doctrine:database:create)
(cd src/Bundle/test && bin/console doctrine:schema:create)

-
name: Run analysis
Expand All @@ -103,19 +103,19 @@ jobs:
name: Run smoke tests without friendsofsymfony/rest-bundle willdurand/hateoas-bundle jms/serializer-bundle packages
run: |
composer remove friendsofsymfony/rest-bundle willdurand/hateoas-bundle jms/serializer-bundle --no-scripts
(cd src/Bundle/test && app/console cache:clear --env=test_without_fosrest)
(cd src/Bundle/test && bin/console cache:clear --env=test_without_fosrest)
composer require friendsofsymfony/rest-bundle willdurand/hateoas-bundle jms/serializer-bundle --no-scripts

-
name: Run smoke tests without winzou/state-machine-bundle package
run: |
composer remove winzou/state-machine-bundle --no-scripts
(cd src/Bundle/test && app/console cache:clear --env=test_without_state_machine)
(cd src/Bundle/test && bin/console cache:clear --env=test_without_state_machine)
composer require winzou/state-machine-bundle --no-scripts

-
name: Run smoke tests without twig/twig package
run: |
composer remove symfony/twig-bundle --no-scripts
(cd src/Bundle/test && app/console cache:clear --env=test_without_twig)
(cd src/Bundle/test && bin/console cache:clear --env=test_without_twig)
composer require symfony/twig-bundle --no-scripts
8 changes: 3 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"sylius-labs/coding-standard": "^3.0",
"sylius/grid-bundle": "^1.7",
"symfony/dependency-injection": "^4.4 || ^5.1",
"symfony/dotenv": "^4.4 || ^5.1",
"twig/twig": "^2.12 || ^3.0",
"vimeo/psalm": "4.2.1"
},
Expand All @@ -88,11 +89,8 @@
"psr-4": {
"Sylius\\Bundle\\ResourceBundle\\spec\\": "src/Bundle/spec/",
"Sylius\\Component\\Resource\\spec\\": "src/Component/spec/",
"AppBundle\\": "src/Bundle/test/src/AppBundle/"
},
"classmap": [
"src/Bundle/test/app/AppKernel.php"
]
"App\\": "src/Bundle/test/src/"
}
},
"scripts": {
"analyse": [
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<php>
<ini name="error_reporting" value="-1" />

<server name="KERNEL_CLASS" value="AppKernel" />
<server name="KERNEL_CLASS" value="App\Kernel" />
<server name="IS_DOCTRINE_ORM_SUPPORTED" value="true" />
<server name="SHELL_VERBOSITY" value="-1" />
</php>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@

namespace Sylius\Bundle\ResourceBundle\Tests\DependencyInjection;

use AppBundle\Entity\Book;
use AppBundle\Entity\BookTranslation;
use AppBundle\Entity\ComicBook;
use AppBundle\Factory\BookFactory;
use App\Entity\Book;
use App\Entity\BookTranslation;
use App\Entity\ComicBook;
use App\Factory\BookFactory;
use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractExtensionTestCase;
use Sylius\Bundle\ResourceBundle\DependencyInjection\SyliusResourceExtension;

Expand Down
6 changes: 3 additions & 3 deletions src/Bundle/Tests/Resource/ResourceServicesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@

namespace Sylius\Bundle\ResourceBundle\Tests\Resource;

use AppBundle\Entity\Book;
use AppBundle\Entity\ComicBook;
use AppBundle\Repository\BookRepository;
use App\Entity\Book;
use App\Entity\ComicBook;
use App\Repository\BookRepository;
use Doctrine\ORM\EntityManager;
use Sylius\Bundle\ResourceBundle\Controller\ResourceController;
use Sylius\Component\Resource\Factory\FactoryInterface;
Expand Down
1 change: 1 addition & 0 deletions src/Bundle/test/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
APP_ENV=test
34 changes: 0 additions & 34 deletions src/Bundle/test/app/AppKernel.php

This file was deleted.

58 changes: 0 additions & 58 deletions src/Bundle/test/app/config/config.yml

This file was deleted.

6 changes: 0 additions & 6 deletions src/Bundle/test/app/config/parameters.yml

This file was deleted.

23 changes: 0 additions & 23 deletions src/Bundle/test/app/config/resources.yml

This file was deleted.

25 changes: 0 additions & 25 deletions src/Bundle/test/app/console

This file was deleted.

38 changes: 38 additions & 0 deletions src/Bundle/test/bin/console
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env php
<?php

use App\Kernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Debug\Debug;

set_time_limit(0);

require dirname(__DIR__).'/../../../vendor/autoload.php';

if (!class_exists(Application::class)) {
throw new RuntimeException('You need to add "symfony/framework-bundle" as a Composer dependency.');
}

$input = new ArgvInput();
if (null !== $env = $input->getParameterOption(['--env', '-e'], null, true)) {
putenv('APP_ENV='.$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = $env);
}

if ($input->hasParameterOption('--no-debug', true)) {
putenv('APP_DEBUG='.$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = '0');
}

require dirname(__DIR__).'/config/bootstrap.php';

if ($_SERVER['APP_DEBUG']) {
umask(0000);

if (class_exists(Debug::class)) {
Debug::enable();
}
}

$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->run($input);
32 changes: 32 additions & 0 deletions src/Bundle/test/config/bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

declare(strict_types=1);

use Symfony\Component\Dotenv\Dotenv;

require dirname(__DIR__) . '/../../../vendor/autoload.php';

// Load cached env vars if the .env.local.php file exists
// Run "composer dump-env prod" to create it (requires symfony/flex >=1.2)
if (is_array($env = @include dirname(__DIR__) . '/.env.local.php')) {
$_SERVER += $env;
$_ENV += $env;
} elseif (!class_exists(Dotenv::class)) {
throw new RuntimeException('Please run "composer require symfony/dotenv" to load the ".env" files configuring the application.');
} else {
// load all the .env files
(new Dotenv(true))->loadEnv(dirname(__DIR__) . '/.env');
}

$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = ($_SERVER['APP_ENV'] ?? $_ENV['APP_ENV'] ?? null) ?: 'test';
$_SERVER['APP_DEBUG'] = $_SERVER['APP_DEBUG'] ?? $_ENV['APP_DEBUG'] ?? 'prod' !== $_SERVER['APP_ENV'];
$_SERVER['APP_DEBUG'] = $_ENV['APP_DEBUG'] = (int) $_SERVER['APP_DEBUG'] || filter_var($_SERVER['APP_DEBUG'], \FILTER_VALIDATE_BOOLEAN) ? '1' : '0';
1 change: 0 additions & 1 deletion src/Bundle/test/config/bundles.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
BabDev\PagerfantaBundle\BabDevPagerfantaBundle::class => ['all' => true],
Symfony\Bundle\TwigBundle\TwigBundle::class => ['all' => true, 'test_without_twig' => false],
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true],
AppBundle\AppBundle::class => ['all' => true],
FOS\RestBundle\FOSRestBundle::class => ['test' => true],
JMS\SerializerBundle\JMSSerializerBundle::class => ['test' => true],
Bazinga\Bundle\HateoasBundle\BazingaHateoasBundle::class => ['test' => true],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AppBundle\Entity\Author:
App\Entity\Author:
type: embeddable
fields:
firstName:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AppBundle\Entity\Book:
App\Entity\Book:
type: mappedSuperclass
table: app_book
id:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AppBundle\Entity\BookTranslation:
App\Entity\BookTranslation:
type: mappedSuperclass
table: app_book_translation
id:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AppBundle\Entity\ComicBook:
App\Entity\ComicBook:
type: mappedSuperclass
table: app_comic_book
id:
Expand All @@ -13,4 +13,4 @@ AppBundle\Entity\ComicBook:
length: 255
embedded:
author:
class: AppBundle\Entity\Author
class: App\Entity\Author
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AppBundle\Entity\GedmoBaseExample:
App\Entity\GedmoBaseExample:
type: mappedSuperclass
table: gedmo
id:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AppBundle\Entity\GedmoExtendedExample:
App\Entity\GedmoExtendedExample:
type: mappedSuperclass
table: gedmo
fields:
Expand Down
16 changes: 16 additions & 0 deletions src/Bundle/test/config/packages/doctrine.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
doctrine:
dbal:
driver: "%database_driver%"
path: "%database_path%"
charset: UTF8
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
is_bundle: false
type: yml
dir: '%kernel.project_dir%/config/doctrine'
prefix: 'App\Entity'
alias: App
12 changes: 12 additions & 0 deletions src/Bundle/test/config/packages/framework.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
framework:
assets: false
translator: { fallbacks: ["%locale%"] }
secret: "%secret%"
form: ~
csrf_protection: true
default_locale: "%locale%"
session:
handler_id: ~
storage_id: session.storage.mock_file
http_method_override: true
test: ~
Loading