enableSecondLevelCache(); parent::setUp(); $this->application = new Application(); $this->command = new EntityRegionCommand(); $this->application->setHelperSet(new HelperSet(array( 'em' => new EntityManagerHelper($this->_em) ))); $this->application->add($this->command); } public function testClearAllRegion() { $command = $this->application->find('orm:clear-cache:region:entity'); $tester = new CommandTester($command); $tester->execute(array( 'command' => $command->getName(), '--all' => true, )); $this->assertEquals('Clearing all second-level cache entity regions' . PHP_EOL, $tester->getDisplay()); } public function testClearByEntityClassName() { $command = $this->application->find('orm:clear-cache:region:entity'); $tester = new CommandTester($command); $tester->execute(array( 'command' => $command->getName(), 'entity-class' => 'Doctrine\Tests\Models\Cache\Country', )); $this->assertEquals('Clearing second-level cache for entity "Doctrine\Tests\Models\Cache\Country"' . PHP_EOL, $tester->getDisplay()); } public function testClearCacheEntryName() { $command = $this->application->find('orm:clear-cache:region:entity'); $tester = new CommandTester($command); $tester->execute(array( 'command' => $command->getName(), 'entity-class' => 'Doctrine\Tests\Models\Cache\Country', 'entity-id' => 1, )); $this->assertEquals('Clearing second-level cache entry for entity "Doctrine\Tests\Models\Cache\Country" identified by "1"' . PHP_EOL, $tester->getDisplay()); } public function testFlushRegionName() { $command = $this->application->find('orm:clear-cache:region:entity'); $tester = new CommandTester($command); $tester->execute(array( 'command' => $command->getName(), 'entity-class' => 'Doctrine\Tests\Models\Cache\Country', '--flush' => true, )); $this->assertEquals('Flushing cache provider configured for entity named "Doctrine\Tests\Models\Cache\Country"' . PHP_EOL, $tester->getDisplay()); } }