Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into Deprecate_assets_option
  • Loading branch information
eerison committed Sep 6, 2022
2 parents 8129d46 + 9389aab commit eac61ee
Show file tree
Hide file tree
Showing 12 changed files with 19 additions and 39 deletions.
7 changes: 6 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,14 @@
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true],
'ordered_class_elements' => true,
'ordered_imports' => ['sort_algorithm' => 'alpha', 'imports_order' => ['class', 'function', 'const']],
'phpdoc_order' => ['order' => ['var', 'param', 'throws', 'return', 'phpstan-var', 'psalm-var', 'phpstan-param', 'psalm-param', 'phpstan-return', 'psalm-return']],
'phpdoc_separation' => ['groups' => [
['phpstan-template', 'phpstan-template-covariant', 'phpstan-extends', 'phpstan-implements', 'phpstan-var', 'psalm-var', 'phpstan-param', 'psalm-param', 'phpstan-return', 'psalm-return'],
['psalm-suppress', 'phpstan-ignore-next-line'],
]],
'php_unit_strict' => true,
'php_unit_test_case_static_method_calls' => true,
'phpdoc_to_comment' => ['ignored_tags' => ['psalm-suppress']],
'phpdoc_to_comment' => ['ignored_tags' => ['psalm-suppress', 'phpstan-var']],
'single_line_throw' => false,
'static_lambda' => true,
'strict_comparison' => true,
Expand Down
2 changes: 1 addition & 1 deletion bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ set_time_limit(0);

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

$kernel = new AppKernel();
$kernel = new AppKernel('test', false);
$application = new Application($kernel);
$application->run(new ArgvInput());
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"sonata-project/cache-bundle": "^3.3",
"symfony/browser-kit": "^4.4",
"symfony/css-selector": "^4.4",
"symfony/filesystem": "^4.4",
"symfony/phpunit-bridge": "^5.1.4",
"vimeo/psalm": "^4.7.2"
},
Expand Down
3 changes: 3 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,8 @@ It's auto-generated by sonata-project/dev-kit package.
<php>
<ini name="precision" value="8" />
<env name="SYMFONY_DEPRECATIONS_HELPER" value="max[self]=0" />
<env name="KERNEL_CLASS" value="\Sonata\PageBundle\Tests\App\AppKernel" />
<server name="APP_ENV" value="test" force="true" />
<server name="APP_DEBUG" value="false" />
</php>
</phpunit>
7 changes: 2 additions & 5 deletions tests/App/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ final class AppKernel extends Kernel
{
use MicroKernelTrait;

public function __construct()
{
parent::__construct('test', false);
}

public function registerBundles(): array
{
$bundles = [
Expand Down Expand Up @@ -95,6 +90,8 @@ protected function configureRoutes(RouteCollectionBuilder $routes): void

protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader): void
{
$container->setParameter('app.base_dir', $this->getBaseDir());

$loader->load($this->getProjectDir().'/config/config.yaml');
}

Expand Down
2 changes: 1 addition & 1 deletion tests/App/config/doctrine.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
doctrine:
dbal:
url: 'sqlite:///%kernel.cache_dir%/data.db'
url: 'sqlite:///%app.base_dir%database.db'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
Expand Down
6 changes: 0 additions & 6 deletions tests/Command/CleanupSnapshotsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use Sonata\PageBundle\Model\SiteInterface;
use Sonata\PageBundle\Model\SiteManagerInterface;
use Sonata\PageBundle\Service\Contract\CleanupSnapshotBySiteInterface;
use Sonata\PageBundle\Tests\App\AppKernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Console\Tester\CommandTester;
Expand Down Expand Up @@ -174,9 +173,4 @@ public function testCleanupSnapshot(): void
static::assertStringContainsString('- Cleaning up snapshots ...', $output);
static::assertStringContainsString('done!', $output);
}

protected static function getKernelClass(): string
{
return AppKernel::class;
}
}
6 changes: 0 additions & 6 deletions tests/Command/CreateSnapshotsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Sonata\PageBundle\Model\SiteInterface;
use Sonata\PageBundle\Model\SiteManagerInterface;
use Sonata\PageBundle\Service\Contract\CreateSnapshotBySiteInterface;
use Sonata\PageBundle\Tests\App\AppKernel;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Console\Input\InputInterface;
Expand Down Expand Up @@ -202,9 +201,4 @@ public function testRequireSiteAllArgument()

static::assertStringContainsString('Please provide an --site=SITE_ID option or the --site=all directive', $output);
}

protected static function getKernelClass(): string
{
return AppKernel::class;
}
}
6 changes: 0 additions & 6 deletions tests/Functional/Snapshot/SnapshotManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\OptimisticLockException;
use Sonata\PageBundle\Entity\SnapshotManager;
use Sonata\PageBundle\Tests\App\AppKernel;
use Sonata\PageBundle\Tests\App\Entity\SonataPagePage;
use Sonata\PageBundle\Tests\App\Entity\SonataPageSnapshot;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
Expand Down Expand Up @@ -244,9 +243,4 @@ public static function assertDateTimeEquals(\DateTime $expected, \DateTime $actu
{
static::assertSame($expected->format('c'), $actual->format('c'));
}

protected static function getKernelClass(): string
{
return AppKernel::class;
}
}
6 changes: 0 additions & 6 deletions tests/Functional/Ticket/Issue1134Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

namespace Sonata\PageBundle\Tests\Functional\Ticket;

use Sonata\PageBundle\Tests\App\AppKernel;
use Sonata\PageBundle\Tests\App\Entity\SonataPageSite;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -56,9 +55,4 @@ public function testLabelInShowAction(): void

static::assertSame(Response::HTTP_OK, $client->getResponse()->getStatusCode());
}

protected static function getKernelClass(): string
{
return AppKernel::class;
}
}
6 changes: 0 additions & 6 deletions tests/Page/TemplateManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
use Sonata\PageBundle\Model\PageInterface;
use Sonata\PageBundle\Model\Template;
use Sonata\PageBundle\Page\TemplateManager;
use Sonata\PageBundle\Tests\App\AppKernel;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\DomCrawler\Crawler;
Expand Down Expand Up @@ -207,11 +206,6 @@ public function testTemplateShowingBreadcrumbIntoThePage(): void
static::assertStringContainsString('Foo', $breadcrumbFoo->text());
}

protected static function getKernelClass(): string
{
return AppKernel::class;
}

/**
* Returns the mock template.
*/
Expand Down
6 changes: 5 additions & 1 deletion tests/custom_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Filesystem\Filesystem;

$application = new Application(new AppKernel());
$kernel = new AppKernel($_SERVER['APP_ENV'], $_SERVER['APP_DEBUG']);
$application = new Application($kernel);
$application->setAutoExit(false);

$input = new ArrayInput([
Expand All @@ -35,3 +37,5 @@
'command' => 'doctrine:schema:create',
]);
$application->run($input, new NullOutput());

(new Filesystem())->remove([$kernel->getCacheDir()]);

0 comments on commit eac61ee

Please sign in to comment.