Eccube\Tests\Web\Admin\Product\ProductClassControllerTest::testRoutingAdminProductProductClassEdit PHP Метод

testRoutingAdminProductProductClassEdit() публичный Метод

    public function testRoutingAdminProductProductClassEdit()
    {
        // before
        $TestCreator = $this->createMember();
        $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));
        // 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();
    }