Eccube\Tests\Plugin\Web\Admin\Product\ProductClassControllerTest::testRoutingAdminProductProductClassEdit PHP Method

testRoutingAdminProductProductClassEdit() public method

    public function testRoutingAdminProductProductClassEdit()
    {
        // before
        $TestCreator = $this->app['orm.em']->getRepository('\\Eccube\\Entity\\Member')->find(1);
        $TestProduct = $this->newTestProduct($TestCreator);
        $this->app['orm.em']->persist($TestProduct);
        $this->app['orm.em']->flush();
        $TestClassName = $this->newTestClassName($TestCreator);
        $this->app['orm.em']->persist($TestClassName);
        $this->app['orm.em']->flush();
        $TestClassCategory1 = $this->newTestClassCategory($TestCreator, $TestClassName);
        $this->app['orm.em']->persist($TestClassCategory1);
        $this->app['orm.em']->flush();
        $TestClassCategory2 = $this->newTestClassCategory($TestCreator, $TestClassName);
        $this->app['orm.em']->persist($TestClassCategory2);
        $this->app['orm.em']->flush();
        $TestProductClass = $this->newTestProductClass($TestCreator, $TestProduct, $TestClassCategory1, $TestClassCategory2);
        $this->app['orm.em']->persist($TestProductClass);
        $this->app['orm.em']->flush();
        $TestProductStock = $this->newTestProductStock($TestCreator, $TestProduct, $TestProductClass);
        $this->app['orm.em']->persist($TestProductStock);
        $this->app['orm.em']->flush();
        // main
        $redirectUrl = $this->app->url('admin_product_product_class', array('id' => $TestProduct->getId()));
        $this->client->request('POST', $this->app->url('admin_product_product_class_edit', array('id' => $TestProduct->getId())));
        $this->assertTrue($this->client->getResponse()->isRedirect($redirectUrl));
        $expected = array(EccubeEvents::ADMIN_PRODUCT_PRODUCT_CLASS_EDIT_INITIALIZE);
        $this->verifyOutputString($expected);
        // after
        $this->app['orm.em']->remove($TestProductClass);
        $this->app['orm.em']->flush();
        $this->app['orm.em']->remove($TestClassCategory2);
        $this->app['orm.em']->flush();
        $this->app['orm.em']->remove($TestClassCategory1);
        $this->app['orm.em']->flush();
        $this->app['orm.em']->remove($TestClassName);
        $this->app['orm.em']->flush();
        $this->app['orm.em']->remove($TestProduct);
        $this->app['orm.em']->flush();
    }