Skip to content

Commit ca421a0

Browse files
committed
Fix AppKernel
1 parent 682a4ad commit ca421a0

7 files changed

+4
-35
lines changed

phpstan-console-application.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616

1717
require __DIR__.'/vendor/autoload.php';
1818

19-
$kernel = new AppKernel();
19+
$kernel = new AppKernel('test', false);
2020

2121
return new Application($kernel);

tests/App/AppKernel.php

-5
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,6 @@ final class AppKernel extends Kernel
3535
{
3636
use MicroKernelTrait;
3737

38-
public function __construct()
39-
{
40-
parent::__construct('test', false);
41-
}
42-
4338
public function registerBundles(): iterable
4439
{
4540
return [

tests/Functional/Controller/AdminAsParameterControllerTest.php

-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
namespace Sonata\AdminBundle\Tests\Functional\Controller;
1515

16-
use Sonata\AdminBundle\Tests\App\AppKernel;
1716
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
1817
use Symfony\Component\HttpFoundation\Request;
1918
use Symfony\Component\HttpFoundation\Response;
@@ -41,9 +40,4 @@ public function urlIsSuccessfulDataProvider(): iterable
4140
['/admin/tests/app/admin-as-parameter/invokable?uniqid=invokable'],
4241
];
4342
}
44-
45-
protected static function getKernelClass(): string
46-
{
47-
return AppKernel::class;
48-
}
4943
}

tests/Functional/Controller/CRUDControllerTest.php

-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
namespace Sonata\AdminBundle\Tests\Functional\Controller;
1515

16-
use Sonata\AdminBundle\Tests\App\AppKernel;
1716
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
1817
use Symfony\Component\HttpFoundation\Request;
1918
use Symfony\Component\HttpFoundation\Response;
@@ -143,9 +142,4 @@ public function urlIsSuccessfulDataProvider(): iterable
143142
['/admin/tests/app/bar/test_id/baz/list'],
144143
];
145144
}
146-
147-
protected static function getKernelClass(): string
148-
{
149-
return AppKernel::class;
150-
}
151145
}

tests/Functional/Controller/DashboardActionTest.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,15 @@
1313

1414
namespace Sonata\AdminBundle\Tests\Functional\Controller;
1515

16-
use PHPUnit\Framework\TestCase;
17-
use Sonata\AdminBundle\Tests\App\AppKernel;
18-
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
16+
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
1917
use Symfony\Component\HttpFoundation\Request;
2018
use Symfony\Component\HttpFoundation\Response;
2119

22-
final class DashboardActionTest extends TestCase
20+
final class DashboardActionTest extends WebTestCase
2321
{
2422
public function testDashboard(): void
2523
{
26-
$client = new KernelBrowser(new AppKernel());
24+
$client = static::createClient();
2725
$client->request(Request::METHOD_GET, '/admin/dashboard');
2826

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

tests/Functional/Controller/MenuTest.php

-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
namespace Sonata\AdminBundle\Tests\Functional\Controller;
1515

16-
use Sonata\AdminBundle\Tests\App\AppKernel;
1716
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
1817
use Symfony\Component\HttpFoundation\Request;
1918
use Symfony\Component\HttpFoundation\Response;
@@ -38,9 +37,4 @@ public function testDynamicMenuInLongRunningProcess(): void
3837
static::assertSame(sprintf('Dynamic Menu %s', $i), trim($menu->text()));
3938
}
4039
}
41-
42-
protected static function getKernelClass(): string
43-
{
44-
return AppKernel::class;
45-
}
4640
}

tests/Functional/Translator/Extractor/AdminExtractorTest.php

-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
namespace Sonata\AdminBundle\Tests\Functional\Translator\Extractor;
1515

16-
use Sonata\AdminBundle\Tests\App\AppKernel;
1716
use Symfony\Bundle\FrameworkBundle\Console\Application;
1817
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
1918
use Symfony\Component\Console\Tester\CommandTester;
@@ -33,11 +32,6 @@ public function testDebugMissingMessages(): void
3332
static::assertMatchesRegularExpression('/Date Published/', $tester->getDisplay());
3433
}
3534

36-
protected static function getKernelClass(): string
37-
{
38-
return AppKernel::class;
39-
}
40-
4135
private function createCommandTester(): CommandTester
4236
{
4337
$kernel = static::createKernel();

0 commit comments

Comments
 (0)