Eccube\Tests\Plugin\Web\Admin\Product\ClassCategoryControllerTest::testRoutingAdminProductClassCategoryDelete PHP Method

testRoutingAdminProductClassCategoryDelete() public method

    public function testRoutingAdminProductClassCategoryDelete()
    {
        // before
        $TestCreator = $this->app['orm.em']->getRepository('\\Eccube\\Entity\\Member')->find(1);
        $TestClassName = $this->newTestClassName($TestCreator);
        $this->app['orm.em']->persist($TestClassName);
        $this->app['orm.em']->flush();
        $test_class_name_id = $this->app['eccube.repository.class_name']->findOneBy(array('name' => $TestClassName->getName()))->getId();
        $TestClassCategory = $this->newTestClassCategory($TestCreator, $TestClassName);
        $this->app['orm.em']->persist($TestClassCategory);
        $this->app['orm.em']->flush();
        $test_class_category_id = $this->app['eccube.repository.class_category']->findOneBy(array('name' => $TestClassCategory->getName()))->getId();
        // main
        $redirectUrl = $this->app->url('admin_product_class_category', array('class_name_id' => $test_class_name_id));
        $this->client->request('DELETE', $this->app->url('admin_product_class_category_delete', array('class_name_id' => $test_class_name_id, 'id' => $test_class_category_id)));
        $this->assertTrue($this->client->getResponse()->isRedirect($redirectUrl));
        $expected = array(EccubeEvents::ADMIN_PRODUCT_CLASS_CATEGORY_DELETE_COMPLETE);
        $this->verifyOutputString($expected);
        // after
        $this->app['orm.em']->remove($TestClassCategory);
        $this->app['orm.em']->flush();
        $this->app['orm.em']->remove($TestClassName);
        $this->app['orm.em']->flush();
    }