| @@ 47-64 (lines=18) @@ | ||
| 44 | */ |
|
| 45 | private $objectManager; |
|
| 46 | ||
| 47 | protected function setUp() |
|
| 48 | { |
|
| 49 | $this->objectManager = new ObjectManager($this); |
|
| 50 | ||
| 51 | $checkoutSession = $this->getMockBuilder(Session::class) |
|
| 52 | ->disableOriginalConstructor() |
|
| 53 | ->setMethods(['getPayoneWorkorderId']) |
|
| 54 | ->getMock(); |
|
| 55 | $checkoutSession->method('getPayoneWorkorderId')->willReturn('12345'); |
|
| 56 | ||
| 57 | $url = $this->getMockBuilder(Url::class)->disableOriginalConstructor()->getMock(); |
|
| 58 | $url->method('getUrl')->willReturn('http://testdomain.org'); |
|
| 59 | ||
| 60 | $this->classToTest = $this->objectManager->getObject(ClassToTest::class, [ |
|
| 61 | 'checkoutSession' => $checkoutSession, |
|
| 62 | 'url' => $url |
|
| 63 | ]); |
|
| 64 | } |
|
| 65 | ||
| 66 | public function testIsPayPalExpress() |
|
| 67 | { |
|
| @@ 49-64 (lines=16) @@ | ||
| 46 | */ |
|
| 47 | private $objectManager; |
|
| 48 | ||
| 49 | protected function setUp() |
|
| 50 | { |
|
| 51 | $this->objectManager = new ObjectManager($this); |
|
| 52 | ||
| 53 | $paymentHelper = $this->getMockBuilder(Payment::class)->disableOriginalConstructor()->getMock(); |
|
| 54 | $paymentHelper->method('getStatusMappingByCode')->willReturn([ |
|
| 55 | 'paid' => 'new' |
|
| 56 | ]); |
|
| 57 | $databaseHelper = $this->getMockBuilder(Database::class)->disableOriginalConstructor()->getMock(); |
|
| 58 | $databaseHelper->method('getStateByStatus')->willReturn('pending'); |
|
| 59 | ||
| 60 | $this->classToTest = $this->objectManager->getObject(ClassToTest::class, [ |
|
| 61 | 'paymentHelper' => $paymentHelper, |
|
| 62 | 'databaseHelper' => $databaseHelper |
|
| 63 | ]); |
|
| 64 | } |
|
| 65 | ||
| 66 | public function testHandleMapping() |
|
| 67 | { |
|
| @@ 50-64 (lines=15) @@ | ||
| 47 | */ |
|
| 48 | private $apiHelper; |
|
| 49 | ||
| 50 | protected function setUp() |
|
| 51 | { |
|
| 52 | $objectManager = new ObjectManager($this); |
|
| 53 | ||
| 54 | $this->apiHelper = $this->getMockBuilder(Api::class)->disableOriginalConstructor()->getMock(); |
|
| 55 | ||
| 56 | $customerHelper = $this->getMockBuilder(Customer::class)->disableOriginalConstructor()->getMock(); |
|
| 57 | $customerHelper->method('getSalutationParameter')->willReturn('mr'); |
|
| 58 | $customerHelper->method('getGenderParameter')->willReturn('m'); |
|
| 59 | ||
| 60 | $this->classToTest = $objectManager->getObject(ClassToTest::class, [ |
|
| 61 | 'apiHelper' => $this->apiHelper, |
|
| 62 | 'customerHelper' => $customerHelper |
|
| 63 | ]); |
|
| 64 | } |
|
| 65 | ||
| 66 | public function testSendRequest() |
|
| 67 | { |
|