Release 2.25 (#5109)
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
namespace App\Tests\Repository;
|
||||
|
||||
use App\Tests\KernelTestTrait;
|
||||
use Doctrine\Bundle\DoctrineBundle\Registry;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\Persistence\ObjectManager;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
||||
@@ -21,35 +22,24 @@ abstract class AbstractRepositoryTest extends KernelTestCase
|
||||
{
|
||||
use KernelTestTrait;
|
||||
|
||||
/**
|
||||
* @var ObjectManager|null
|
||||
*/
|
||||
private $entityManager;
|
||||
private ?ObjectManager $entityManager = null;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function setUp(): void
|
||||
{
|
||||
parent::setUp();
|
||||
$kernel = self::bootKernel();
|
||||
|
||||
$this->entityManager = $kernel->getContainer()
|
||||
->get('doctrine')
|
||||
->getManager();
|
||||
/** @var Registry $doctrine */
|
||||
$doctrine = $kernel->getContainer()->get('doctrine');
|
||||
|
||||
$this->entityManager = $doctrine->getManager();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return ObjectManager
|
||||
*/
|
||||
protected function getEntityManager()
|
||||
protected function getEntityManager(): ObjectManager
|
||||
{
|
||||
return $this->entityManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
|
||||
namespace App\Tests\Repository;
|
||||
|
||||
use App\Model\InvoiceDocument;
|
||||
use App\Repository\InvoiceDocumentRepository;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
@@ -78,7 +77,7 @@ class InvoiceDocumentRepositoryTest extends TestCase
|
||||
foreach (self::$testDocuments as $document) {
|
||||
$all[] = substr($document, 0, strpos($document, '.'));
|
||||
}
|
||||
$all = array_unique(array_values($all));
|
||||
$all = array_unique($all);
|
||||
self::assertCount(\count($all), $sut->findAll());
|
||||
|
||||
self::assertEquals($path, $sut->getUploadDirectory());
|
||||
@@ -98,7 +97,6 @@ class InvoiceDocumentRepositoryTest extends TestCase
|
||||
$filename = substr($filename, 0, strpos($filename, '.'));
|
||||
$actual = $sut->findByName($filename);
|
||||
$this->assertNotNull($actual);
|
||||
$this->assertInstanceOf(InvoiceDocument::class, $actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
namespace App\Tests\Repository\Query;
|
||||
|
||||
use App\Repository\Query\ActivityQuery;
|
||||
use App\Repository\Query\VisibilityInterface;
|
||||
|
||||
/**
|
||||
* @covers \App\Repository\Query\ActivityQuery
|
||||
@@ -23,11 +22,8 @@ class ActivityQueryTest extends BaseQueryTest
|
||||
$sut = new ActivityQuery();
|
||||
|
||||
$this->assertBaseQuery($sut, 'name');
|
||||
$this->assertInstanceOf(VisibilityInterface::class, $sut);
|
||||
|
||||
$this->assertCustomer($sut);
|
||||
$this->assertProject($sut);
|
||||
|
||||
$this->assertResetByFormError(new ActivityQuery(), 'name');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
namespace App\Tests\Repository\Query;
|
||||
|
||||
use App\Repository\Query\CustomerQuery;
|
||||
use App\Repository\Query\VisibilityInterface;
|
||||
|
||||
/**
|
||||
* @covers \App\Repository\Query\CustomerQuery
|
||||
@@ -22,8 +21,6 @@ class CustomerQueryTest extends BaseQueryTest
|
||||
$sut = new CustomerQuery();
|
||||
|
||||
$this->assertBaseQuery($sut, 'name');
|
||||
$this->assertInstanceOf(VisibilityInterface::class, $sut);
|
||||
|
||||
$this->assertResetByFormError(new CustomerQuery(), 'name');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
namespace App\Tests\Repository\Query;
|
||||
|
||||
use App\Repository\Query\ProjectQuery;
|
||||
use App\Repository\Query\VisibilityInterface;
|
||||
|
||||
/**
|
||||
* @covers \App\Repository\Query\ProjectQuery
|
||||
@@ -23,10 +22,7 @@ class ProjectQueryTest extends BaseQueryTest
|
||||
$sut = new ProjectQuery();
|
||||
|
||||
$this->assertBaseQuery($sut, 'name');
|
||||
$this->assertInstanceOf(VisibilityInterface::class, $sut);
|
||||
|
||||
$this->assertCustomer($sut);
|
||||
|
||||
$this->assertResetByFormError(new ProjectQuery(), 'name');
|
||||
|
||||
self::assertNull($sut->getProjectStart());
|
||||
|
||||
@@ -21,8 +21,6 @@ class TagQueryTest extends BaseQueryTest
|
||||
$sut = new TagQuery();
|
||||
|
||||
$this->assertBaseQuery($sut, 'name');
|
||||
$this->assertInstanceOf(TagQuery::class, $sut);
|
||||
|
||||
$this->assertResetByFormError(new TagQuery(), 'name');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,7 @@ class TeamQueryTest extends BaseQueryTest
|
||||
$sut = new TeamQuery();
|
||||
|
||||
$this->assertBaseQuery($sut, 'name');
|
||||
$this->assertInstanceOf(TeamQuery::class, $sut);
|
||||
|
||||
$this->assertUsers($sut);
|
||||
|
||||
$this->assertResetByFormError(new TeamQuery(), 'name');
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace App\Tests\Repository\Query;
|
||||
|
||||
use App\Entity\Team;
|
||||
use App\Repository\Query\UserQuery;
|
||||
use App\Repository\Query\VisibilityInterface;
|
||||
|
||||
/**
|
||||
* @covers \App\Repository\Query\UserQuery
|
||||
@@ -22,10 +21,8 @@ class UserQueryTest extends BaseQueryTest
|
||||
{
|
||||
$sut = new UserQuery();
|
||||
$this->assertBaseQuery($sut, 'username');
|
||||
$this->assertInstanceOf(VisibilityInterface::class, $sut);
|
||||
$this->assertRole($sut);
|
||||
$this->assertSearchTeam($sut);
|
||||
|
||||
$this->assertResetByFormError(new UserQuery(), 'username');
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ class TimesheetInvoiceItemRepositoryTest extends TestCase
|
||||
|
||||
$sut->setExported([new Timesheet(), null, new \stdClass(), new Timesheet(), new Activity()]);
|
||||
// test else for empty array
|
||||
/* @phpstan-ignore-next-line */
|
||||
/* @phpstan-ignore argument.type */
|
||||
$sut->setExported([new Customer('foo'), new Project()]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user