/** * @return ChargeRequest */ private function createChargeRequest() { $request = new ChargeRequest(); $request->setToken(new Token('_card_'))->setAmount(new Money(1000, 'JPY'))->setCapture(false)->addProduct((new Product('product-a'))->setTitle('Product.A')->setDescription('This is Product.A')->setPrice(new Money(500, 'JPY'))->setLanguage('JP')->setCount(1)->setStock(10))->addProduct((new Product('product-b'))->setTitle('Product.B')->setDescription('This is Product.B')->setPrice(new Money(500, 'JPY'))->setLanguage('JP')->setCount(3)->setStock(5)); return $request; }
/** * @test * * @expectedException \InvalidArgumentException * @expectedExceptionMessage $card must be an instance of Issei\Spike\Model\Token or a string. */ public function setToken_should_throw_an_InvalidArgumentException_if_given_value_is_neither_Token_instance_nor_string() { $request = new ChargeRequest(); $request->setToken(null); }