factory = new ORMPurgerFactory(); $this->em = $this->createMock(EntityManagerInterface::class); } public function testCreateDefault() : void { /** @var ORMPurger $purger */ $purger = $this->factory->createForEntityManager(null, $this->em); self::assertInstanceOf(ORMPurger::class, $purger); self::assertSame(ORMPurger::PURGE_MODE_DELETE, $purger->getPurgeMode()); self::assertSame([], (function () { return $this->excluded; })->call($purger)); } public function testCreateWithExclusions() : void { /** @var ORMPurger $purger */ $purger = $this->factory->createForEntityManager(null, $this->em, ['tableName']); self::assertInstanceOf(ORMPurger::class, $purger); self::assertSame(ORMPurger::PURGE_MODE_DELETE, $purger->getPurgeMode()); self::assertSame(['tableName'], (function () { return $this->excluded; })->call($purger)); } public function testCreateWithTruncate() : void { /** @var ORMPurger $purger */ $purger = $this->factory->createForEntityManager(null, $this->em, [], true); self::assertInstanceOf(ORMPurger::class, $purger); self::assertSame(ORMPurger::PURGE_MODE_TRUNCATE, $purger->getPurgeMode()); self::assertSame([], (function () { return $this->excluded; })->call($purger)); } }