public function setUp() { parent::setUp(); $this->removeBlock(); $this->DeviceType = $this->app['eccube.repository.master.device_type']->find(DeviceType::DEVICE_TYPE_PC); for ($i = 0; $i < 10; $i++) { $Block = new Block(); $Block->setName('block-' . $i)->setFileName('block/block-' . $i)->setLogicFlg(1)->setDeletableFlg(0)->setDeviceType($this->DeviceType); $this->app['orm.em']->persist($Block); $this->app['orm.em']->flush(); // ここで flush しないと, MySQL で ID が取得できない $this->block_id = $Block->getId(); } }
public function test_routing_AdminContentBlock_blockDelete() { $redirectUrl = $this->app->url('admin_content_block'); $DeviceType = $this->app['eccube.repository.master.device_type']->find(DeviceType::DEVICE_TYPE_PC); $Block = new Block(); $Block->setDeviceType($DeviceType); $Block->setFileName('dummy'); $Block->setLogicFlg($Block::UNUSED_BLOCK_ID); $Block->setDeletableFlg(2); $this->app['orm.em']->persist($Block); $this->app['orm.em']->flush(); $this->client->request('DELETE', $this->app->url('admin_content_block_delete', array('id' => $Block->getId()))); $actual = $this->client->getResponse()->isRedirect($redirectUrl); $this->assertSame(true, $actual); $hookpoints = array(EccubeEvents::ADMIN_CONTENT_BLOCK_DELETE_COMPLETE); $this->verifyOutputString($hookpoints); }