public function testCompleteWithLogin()
{
$faker = $this->getFaker();
$Customer = $this->logIn();
$CustomerAddress = $this->createCustomerAddress($Customer);
$client = $this->client;
// カート画面
$this->scenarioCartIn($client);
$this->scenarioCartIn($client);
// 2個カート投入
// 確認画面
$crawler = $this->scenarioConfirm($client);
$this->expected = 'ご注文内容のご確認';
$this->actual = $crawler->filter('h1.page-heading')->text();
$this->verify();
// 複数配送画面
$crawler = $client->request('GET', $this->app->path('shopping_shipping_multiple'));
// 配送先1, 配送先2の情報を返す
$shippings = $crawler->filter('#form_shipping_multiple_0_shipping_0_customer_address > option')->each(function ($node, $i) {
return array('customer_address' => $node->attr('value'), 'quantity' => 1);
});
$crawler = $client->request('POST', $this->app->path('shopping_shipping_multiple'), array('form' => array('shipping_multiple' => array(0 => array('shipping' => $shippings)), '_token' => 'dummy')));
// 確認画面
$crawler = $this->scenarioConfirm($client);
// 完了画面
$crawler = $this->scenarioComplete($client, $this->app->path('shopping_confirm'), array(array('delivery' => 1, 'deliveryTime' => 1), array('delivery' => 1, 'deliveryTime' => 1)));
$this->assertTrue($client->getResponse()->isRedirect($this->app->url('shopping_complete')));
$BaseInfo = $this->app['eccube.repository.base_info']->get();
$Messages = $this->getMailCatcherMessages();
$Message = $this->getMailCatcherMessage($Messages[0]->id);
$this->expected = '[' . $BaseInfo->getShopName() . '] ご注文ありがとうございます';
$this->actual = $Message->subject;
$this->verify();
$body = $this->parseMailCatcherSource($Message);
$this->assertRegexp('/◎お届け先2/', $body, '複数配送のため, お届け先2が存在する');
// 生成された受注のチェック
$Order = $this->app['eccube.repository.order']->findOneBy(array('Customer' => $Customer));
$OrderNew = $this->app['eccube.repository.order_status']->find($this->app['config']['order_new']);
$this->expected = $OrderNew;
$this->actual = $Order->getOrderStatus();
$this->verify();
$this->expected = $Customer->getName01();
$this->actual = $Order->getName01();
$this->verify();
}