phpstan improvements (#3092)
This commit is contained in:
@@ -31,6 +31,7 @@ class ActivateUserCommandTest extends KernelTestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
$container = self::$kernel->getContainer();
|
||||
|
||||
@@ -31,6 +31,7 @@ class ChangePasswordCommandTest extends KernelTestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
$container = self::$kernel->getContainer();
|
||||
|
||||
@@ -30,6 +30,7 @@ class CreateUserCommandTest extends KernelTestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
$container = self::$kernel->getContainer();
|
||||
|
||||
@@ -31,6 +31,7 @@ class DeactivateUserCommandTest extends KernelTestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
$container = self::$kernel->getContainer();
|
||||
|
||||
@@ -32,6 +32,7 @@ class DemoteUserCommandTest extends KernelTestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
$container = self::$kernel->getContainer();
|
||||
|
||||
@@ -27,6 +27,7 @@ class ImportCustomerCommandTest extends KernelTestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
$container = self::$kernel->getContainer();
|
||||
|
||||
@@ -29,6 +29,7 @@ class ImportProjectCommandTest extends KernelTestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
$container = self::$kernel->getContainer();
|
||||
|
||||
@@ -34,6 +34,7 @@ class ImportTimesheetCommandTest extends KernelTestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ class InstallCommandTest extends KernelTestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
$container = self::$kernel->getContainer();
|
||||
|
||||
@@ -61,6 +61,7 @@ class InvoiceCreateCommandTest extends KernelTestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$this->clearInvoiceFiles();
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
|
||||
@@ -29,6 +29,7 @@ class KimaiImporterCommandTest extends KernelTestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ class PromoteUserCommandTest extends KernelTestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
$container = self::$kernel->getContainer();
|
||||
|
||||
@@ -26,6 +26,7 @@ class ReloadCommandTest extends KernelTestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
$this->application->add(new ReloadCommand());
|
||||
|
||||
@@ -28,6 +28,7 @@ class VersionCommandTest extends KernelTestCase
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$kernel = self::bootKernel();
|
||||
$this->application = new Application($kernel);
|
||||
|
||||
|
||||
@@ -46,10 +46,10 @@ class UserPreferenceTest extends TestCase
|
||||
$sut->setType(IntegerType::class);
|
||||
self::assertSame(1, $sut->getValue());
|
||||
$sut->setType(YesNoType::class);
|
||||
self::assertSame(true, $sut->getValue());
|
||||
self::assertTrue($sut->getValue());
|
||||
$sut->setValue('0');
|
||||
$sut->setType(CheckboxType::class);
|
||||
self::assertSame(false, $sut->getValue());
|
||||
self::assertFalse($sut->getValue());
|
||||
}
|
||||
|
||||
public function testGetLabelWithLabelOption()
|
||||
|
||||
@@ -31,6 +31,7 @@ abstract class AbstractRepositoryTest extends KernelTestCase
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$kernel = self::bootKernel();
|
||||
|
||||
$this->entityManager = $kernel->getContainer()
|
||||
|
||||
19
tests/phpstan-doctrine.php
Normal file
19
tests/phpstan-doctrine.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use App\Kernel;
|
||||
use Symfony\Component\Dotenv\Dotenv;
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
(new Dotenv(false))->loadEnv(dirname(__DIR__) . '/.env');
|
||||
$kernel = new Kernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
|
||||
$kernel->boot();
|
||||
|
||||
return $kernel->getContainer()->get('doctrine')->getManager();
|
||||
@@ -1,7 +1,10 @@
|
||||
includes:
|
||||
- %rootDir%/../phpstan-symfony/extension.neon
|
||||
- %rootDir%/../phpstan-symfony/rules.neon
|
||||
- %rootDir%/../phpstan-doctrine/extension.neon
|
||||
- %rootDir%/../phpstan-doctrine/rules.neon
|
||||
- %rootDir%/../phpstan-phpunit/extension.neon
|
||||
- %rootDir%/../phpstan-phpunit/rules.neon
|
||||
|
||||
parameters:
|
||||
tmpDir: %rootDir%/../../../var/cache/phpstan
|
||||
@@ -9,4 +12,6 @@ parameters:
|
||||
- '#Call to static method PHPUnit\\Framework\\Assert::assertSame\(\) with App\\Entity\\[a-zA-Z0-9]+ and null will always evaluate to false.#'
|
||||
excludePaths:
|
||||
- %rootDir%/../../../tests/Ldap/LdapDriverTest.php
|
||||
inferPrivatePropertyTypeFromConstructor: true
|
||||
inferPrivatePropertyTypeFromConstructor: true
|
||||
doctrine:
|
||||
objectManagerLoader: %rootDir%/../../../tests/phpstan-doctrine.php
|
||||
|
||||
Reference in New Issue
Block a user