kbond /
porpaginas
| 1 | <?php |
||
| 2 | |||
| 3 | namespace Zenstruck\Porpaginas\Tests\Doctrine; |
||
| 4 | |||
| 5 | use Doctrine\ORM\EntityManager; |
||
| 6 | use Doctrine\ORM\Tools\SchemaTool; |
||
| 7 | use Doctrine\ORM\Tools\Setup; |
||
| 8 | use Zenstruck\Porpaginas\Tests\Doctrine\Fixtures\ORMEntity; |
||
| 9 | |||
| 10 | /** |
||
| 11 | * @author Kevin Bond <[email protected]> |
||
| 12 | */ |
||
| 13 | trait HasEntityManager |
||
| 14 | { |
||
| 15 | protected ?EntityManager $em = null; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @before |
||
| 19 | */ |
||
| 20 | protected function setupEntityManager(): void |
||
| 21 | { |
||
| 22 | $paths = []; |
||
| 23 | $isDevMode = false; |
||
| 24 | |||
| 25 | // the connection configuration |
||
| 26 | $dbParams = [ |
||
| 27 | 'driver' => 'pdo_sqlite', |
||
| 28 | 'memory' => true, |
||
| 29 | ]; |
||
| 30 | |||
| 31 | $config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode); |
||
| 32 | $this->em = EntityManager::create($dbParams, $config); |
||
| 33 | |||
| 34 | $schemaTool = new SchemaTool($this->em); |
||
| 35 | $schemaTool->createSchema([ |
||
| 36 | $this->em->getClassMetadata(ORMEntity::class), |
||
| 37 | ]); |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * @after |
||
| 42 | */ |
||
| 43 | protected function teardownEntityManager(): void |
||
| 44 | { |
||
| 45 | $this->em = null; |
||
| 46 | } |
||
| 47 | |||
| 48 | protected function persistEntities(int $count): void |
||
| 49 | { |
||
| 50 | for ($i = 0; $i < $count; ++$i) { |
||
| 51 | $this->em->persist(new ORMEntity('value '.($i + 1))); |
||
|
0 ignored issues
–
show
|
|||
| 52 | } |
||
| 53 | |||
| 54 | $this->em->flush(); |
||
| 55 | $this->em->clear(); |
||
| 56 | } |
||
| 57 | } |
||
| 58 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.