Skip to content

Commit

Permalink
Merge pull request #1 from nanasess/bug_fix
Browse files Browse the repository at this point in the history
issue EC-CUBE#1162 のテストケースを追加
  • Loading branch information
shhirose committed Nov 10, 2015
2 parents c7682ef + 528138e commit f7b5bb1
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/Eccube/Tests/Repository/PaymentRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,40 @@ public function testFindAllowedPaymentWithDeliveryOnly()
$this->verify('商品種別共通の支払い方法は'.$this->expected.'種類です');
}

/**
* 共通する支払い方法が存在しない場合.
*
* @link https://github.com/EC-CUBE/ec-cube/issues/1162
*/
public function testFindAllowedPaymentWithExclusion()
{
$productTypes = array(1, 2);
$productTypes = array_unique($productTypes);

// ProductType 1 と 2 で, 共通する支払い方法を削除しておく
$PaymentOption = $this
->app['orm.em']
->getRepository('\Eccube\Entity\PaymentOption')
->findOneBy(
array(
'delivery_id' => 1,
'payment_id' => 3
)
);
$this->assertNotNull($PaymentOption);
$this->app['orm.em']->remove($PaymentOption);
$this->app['orm.em']->flush();

$deliveries = $this->app['eccube.repository.delivery']->getDeliveries($productTypes);

// 支払方法を取得
$payments = $this->app['eccube.repository.payment']->findAllowedPayments($deliveries);

$this->expected = 0;
$this->actual = count($payments);
$this->verify('商品種別共通の支払い方法は'.$this->expected.'種類です');
}

public function testFindAllArray()
{
$Results = $this->app['eccube.repository.payment']->findAllArray();
Expand Down

0 comments on commit f7b5bb1

Please sign in to comment.