/** * @test */ public function shouldAllowGetPreviouslyAddedKLarnaAddresses() { $request = new GetAddresses('aPno'); $request->addAddress($first = new \KlarnaAddr()); $request->addAddress($second = new \KlarnaAddr()); $addresses = $request->getAddresses(); $this->assertCount(2, $addresses); $this->assertContains($first, $addresses); $this->assertContains($second, $addresses); }
/** * @test */ public function shouldCallKlarnaGetAddresses() { $first = new \KlarnaAddr(); $first->setCountry('SE'); $second = new \KlarnaAddr(); $second->setCountry('SE'); $klarnaMock = $this->createKlarnaMock(); $klarnaMock->expects($this->once())->method('getAddresses')->with('thePno')->will($this->returnValue(array($first, $second))); $action = new GetAddressesAction($klarnaMock); $action->setApi(new Config()); $action->execute($getAddresses = new GetAddresses('thePno')); $this->assertCount(2, $getAddresses->getAddresses()); $this->assertSame($first, $getAddresses->getFirstAddress()); }