diff --git a/Resource/template/admin/order_pdf.twig b/Resource/template/admin/order_pdf.twig index 36a929b..ff800ef 100644 --- a/Resource/template/admin/order_pdf.twig +++ b/Resource/template/admin/order_pdf.twig @@ -23,7 +23,7 @@ {% block main %}
-
+ {{ form_widget(form._token) }}
diff --git a/Resource/template/admin/order_pdf_menu.twig b/Resource/template/admin/order_pdf_menu.twig index d3ee0fe..c859e75 100644 --- a/Resource/template/admin/order_pdf_menu.twig +++ b/Resource/template/admin/order_pdf_menu.twig @@ -8,4 +8,4 @@ * file that was distributed with this source code. */ #} -
  • 帳票出力
  • +
  • 帳票出力
  • diff --git a/ServiceProvider/OrderPdfServiceProvider.php b/ServiceProvider/OrderPdfServiceProvider.php index 40831c9..b6679c8 100644 --- a/ServiceProvider/OrderPdfServiceProvider.php +++ b/ServiceProvider/OrderPdfServiceProvider.php @@ -60,11 +60,15 @@ public function register(BaseApplication $app) } // 帳票の作成 $admin->match('/plugin/order-pdf', '\\Plugin\\OrderPdf\\Controller\\OrderPdfController::index') - ->bind('plugin_admin_order_pdf'); + ->bind('admin_plugin_order_pdf'); + $admin->match('/plugin/order-pdf', '\\Plugin\\OrderPdf\\Controller\\OrderPdfController::index') + ->bind('plugin_admin_order_pdf'); // deprecated // PDFファイルダウンロード $admin->post('/plugin/order-pdf/download', '\\Plugin\\OrderPdf\\Controller\\OrderPdfController::download') - ->bind('plugin_admin_order_pdf_download'); + ->bind('admin_plugin_order_pdf_download'); + $admin->post('/plugin/order-pdf/download', '\\Plugin\\OrderPdf\\Controller\\OrderPdfController::download') + ->bind('plugin_admin_order_pdf_download'); // deprecated $app->mount('/'.trim($app['config']['admin_route'], '/').'/', $admin); diff --git a/Tests/Web/OrderPdfControllerTest.php b/Tests/Web/OrderPdfControllerTest.php index 24f0910..c9ae132 100644 --- a/Tests/Web/OrderPdfControllerTest.php +++ b/Tests/Web/OrderPdfControllerTest.php @@ -66,7 +66,7 @@ public function testRenderDownloadWithDefault() /** * @var Crawler $crawler */ - $crawler = $client->request('GET', $this->app->url('plugin_admin_order_pdf').'?ids'.$orderId.'=on'); + $crawler = $client->request('GET', $this->app->url('admin_plugin_order_pdf').'?ids'.$orderId.'=on'); $html = $crawler->filter('.box-body')->html(); $this->assertContains((string) $orderId, $html); $this->assertContains('お買上げ明細書(納品書)', $html); @@ -90,7 +90,7 @@ public function testRenderDownloadWithPreviousInput() /** * @var Crawler $crawler */ - $crawler = $client->request('GET', $this->app->url('plugin_admin_order_pdf').'?ids'.$orderId.'=on'); + $crawler = $client->request('GET', $this->app->url('admin_plugin_order_pdf').'?ids'.$orderId.'=on'); $form = $this->getForm($crawler); /** * @var Generator $faker @@ -109,7 +109,7 @@ public function testRenderDownloadWithPreviousInput() $this->expected = 'application/pdf'; $this->verify(); - $crawler = $client->request('GET', $this->app->url('plugin_admin_order_pdf').'?ids'.$orderId.'=on'); + $crawler = $client->request('GET', $this->app->url('admin_plugin_order_pdf').'?ids'.$orderId.'=on'); $html = $crawler->filter('.box-body')->html(); $this->assertContains((string) $orderId, $html); @@ -132,7 +132,7 @@ public function testDownloadIdInvalid() */ $client = $this->client; - $client->request('GET', $this->app->url('plugin_admin_order_pdf')); + $client->request('GET', $this->app->url('admin_plugin_order_pdf')); $this->assertTrue($client->getResponse()->isRedirect($this->app->url('admin_order'))); /** * @var Crawler $crawler @@ -154,7 +154,7 @@ public function testDownloadWithBadMethod() */ $client = $this->client; - $client->request('GET', $this->app->url('plugin_admin_order_pdf_download')); + $client->request('GET', $this->app->url('admin_plugin_order_pdf_download')); $this->assertTrue($this->hasFailed()); } @@ -179,7 +179,7 @@ public function testDownloadMaxLength($field, $message) /** * @var Crawler $crawler */ - $crawler = $client->request('GET', $this->app->url('plugin_admin_order_pdf').'?ids'.$orderId.'=on'); + $crawler = $client->request('GET', $this->app->url('admin_plugin_order_pdf').'?ids'.$orderId.'=on'); $html = $crawler->filter('.box-body')->html(); $this->assertContains((string) $orderId, $html); $this->assertContains('お買上げ明細書(納品書)', $html); @@ -233,7 +233,7 @@ public function testDownloadSuccess() /** * @var Crawler $crawler */ - $crawler = $client->request('GET', $this->app->url('plugin_admin_order_pdf').'?ids'.$orderId.'=on'); + $crawler = $client->request('GET', $this->app->url('admin_plugin_order_pdf').'?ids'.$orderId.'=on'); $html = $crawler->filter('.box-body')->html(); $this->assertContains((string) $orderId, $html); $this->assertContains('お買上げ明細書(納品書)', $html); @@ -286,7 +286,7 @@ public function testDownloadWithPreviousInputSuccess() $this->app['orm.em']->persist($OrderPdf); $this->app['orm.em']->flush($OrderPdf); - $crawler = $client->request('GET', $this->app->url('plugin_admin_order_pdf').'?ids'.$orderId.'=on'); + $crawler = $client->request('GET', $this->app->url('admin_plugin_order_pdf').'?ids'.$orderId.'=on'); $html = $crawler->filter('.box-body')->html(); $this->assertContains((string) $orderId, $html);