Skip to content

Commit

Permalink
Fix AppKernel
Browse files Browse the repository at this point in the history
  • Loading branch information
jordisala1991 committed Aug 29, 2022
1 parent 223806d commit 394b795
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 52 deletions.
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -65,6 +65,7 @@
"sonata-project/media-bundle": "^4.2",
"sonata-project/twig-extensions": "^1.0",
"symfony/browser-kit": "^4.4 || ^5.4 || ^6.0",
"symfony/filesystem": "^4.4 || ^5.4 || ^6.0",
"symfony/phpunit-bridge": "^6.1",
"symfony/security-bundle": "^4.4 || ^5.4 || ^6.0",
"vimeo/psalm": "^4.19"
Expand Down
10 changes: 0 additions & 10 deletions tests/App/AppKernel.php
Expand Up @@ -35,20 +35,10 @@
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
use Symfony\Component\Security\Http\Authentication\AuthenticatorManager;

/**
* @psalm-suppress PropertyNotSetInConstructor
*
* @see https://github.com/psalm/psalm-plugin-symfony/pull/220
*/
final class AppKernel extends Kernel
{
use MicroKernelTrait;

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

public function registerBundles(): iterable
{
return [
Expand Down
10 changes: 0 additions & 10 deletions tests/Functional/Admin/CkeditorAdminTest.php
Expand Up @@ -14,12 +14,10 @@
namespace Sonata\FormatterBundle\Tests\Functional\Admin;

use Doctrine\ORM\EntityManagerInterface;
use Sonata\FormatterBundle\Tests\App\AppKernel;
use Sonata\FormatterBundle\Tests\App\Entity\Media;
use Sonata\MediaBundle\Model\MediaInterface;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Symfony\Component\HttpKernel\KernelInterface;

final class CkeditorAdminTest extends WebTestCase
{
Expand Down Expand Up @@ -60,14 +58,6 @@ public static function provideCrudUrlsCases(): iterable
]];
}

/**
* @return class-string<KernelInterface>
*/
protected static function getKernelClass(): string
{
return AppKernel::class;
}

/**
* @psalm-suppress UndefinedPropertyFetch
*/
Expand Down
11 changes: 0 additions & 11 deletions tests/Functional/Admin/TextEntityAdminTest.php
Expand Up @@ -14,10 +14,8 @@
namespace Sonata\FormatterBundle\Tests\Functional\Admin;

use Doctrine\ORM\EntityManagerInterface;
use Sonata\FormatterBundle\Tests\App\AppKernel;
use Sonata\FormatterBundle\Tests\App\Entity\TextEntity;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpKernel\KernelInterface;

final class TextEntityAdminTest extends WebTestCase
{
Expand All @@ -43,7 +41,6 @@ public function testCrudUrls(string $url): void
public static function provideCrudUrlsCases(): iterable
{
yield 'Create TextEntity' => ['/admin/tests/app/textentity/create'];

yield 'Edit TextEntity' => ['/admin/tests/app/textentity/1/edit'];
}

Expand Down Expand Up @@ -116,14 +113,6 @@ public static function provideFormUrlsCases(): iterable
yield 'Edit TextEntity' => ['/admin/tests/app/textentity/1/edit', [], 'btn_update_and_list'];
}

/**
* @return class-string<KernelInterface>
*/
protected static function getKernelClass(): string
{
return AppKernel::class;
}

/**
* @psalm-suppress UndefinedPropertyFetch
*/
Expand Down
10 changes: 0 additions & 10 deletions tests/Functional/Block/DashboardBlocksTest.php
Expand Up @@ -13,9 +13,7 @@

namespace Sonata\FormatterBundle\Tests\Functional\Block;

use Sonata\FormatterBundle\Tests\App\AppKernel;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpKernel\KernelInterface;

final class DashboardBlocksTest extends WebTestCase
{
Expand All @@ -40,12 +38,4 @@ public static function provideCrudUrlsCases(): iterable
{
yield 'Ckeditor Browser Media' => ['/admin/dashboard'];
}

/**
* @return class-string<KernelInterface>
*/
protected static function getKernelClass(): string
{
return AppKernel::class;
}
}
8 changes: 3 additions & 5 deletions tests/Functional/Controller/TextFormatterControllerTest.php
Expand Up @@ -13,20 +13,18 @@

namespace Sonata\FormatterBundle\Tests\Functional\Controller;

use PHPUnit\Framework\TestCase;
use Sonata\FormatterBundle\Tests\App\AppKernel;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

final class TextFormatterControllerTest extends TestCase
final class TextFormatterControllerTest extends WebTestCase
{
/**
* @requires extension gd
*/
public function testTruncate(): void
{
$client = new KernelBrowser(new AppKernel());
$client = static::createClient();
$client->request(Request::METHOD_GET, '/text_format');

static::assertSame(Response::HTTP_OK, $client->getResponse()->getStatusCode());
Expand Down
10 changes: 4 additions & 6 deletions tests/custom_bootstrap.php
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 @@ -36,8 +38,4 @@
]);
$application->run($input, new NullOutput());

$input = new ArrayInput([
'command' => 'cache:clear',
'--no-warmup' => true,
]);
$application->run($input, new NullOutput());
(new Filesystem())->remove([$kernel->getCacheDir()]);

0 comments on commit 394b795

Please sign in to comment.