diff --git a/tests/Eccube/Tests/Repository/PaymentRepositoryTest.php b/tests/Eccube/Tests/Repository/PaymentRepositoryTest.php index aa701b7b3c8..51038ce4def 100644 --- a/tests/Eccube/Tests/Repository/PaymentRepositoryTest.php +++ b/tests/Eccube/Tests/Repository/PaymentRepositoryTest.php @@ -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();