|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* PAYONE Magento 2 Connector is free software: you can redistribute it and/or modify |
|
5
|
|
|
* it under the terms of the GNU Lesser General Public License as published by |
|
6
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
|
7
|
|
|
* (at your option) any later version. |
|
8
|
|
|
* |
|
9
|
|
|
* PAYONE Magento 2 Connector is distributed in the hope that it will be useful, |
|
10
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12
|
|
|
* GNU Lesser General Public License for more details. |
|
13
|
|
|
* |
|
14
|
|
|
* You should have received a copy of the GNU Lesser General Public License |
|
15
|
|
|
* along with PAYONE Magento 2 Connector. If not, see <http://www.gnu.org/licenses/>. |
|
16
|
|
|
* |
|
17
|
|
|
* PHP version 5 |
|
18
|
|
|
* |
|
19
|
|
|
* @category Payone |
|
20
|
|
|
* @package Payone_Magento2_Plugin |
|
21
|
|
|
* @author FATCHIP GmbH <[email protected]> |
|
22
|
|
|
* @copyright 2003 - 2017 Payone GmbH |
|
23
|
|
|
* @license <http://www.gnu.org/licenses/> GNU Lesser General Public License |
|
24
|
|
|
* @link http://www.payone.de |
|
25
|
|
|
*/ |
|
26
|
|
|
|
|
27
|
|
|
namespace Payone\Core\Test\Unit\Model\TransactionStatus; |
|
28
|
|
|
|
|
29
|
|
|
use Payone\Core\Model\TransactionStatus\Forwarding as ClassToTest; |
|
30
|
|
|
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; |
|
31
|
|
|
use Payone\Core\Helper\Config; |
|
32
|
|
|
use Magento\Framework\HTTP\Client\Curl; |
|
33
|
|
|
use Payone\Core\Test\Unit\BaseTestCase; |
|
34
|
|
|
use Payone\Core\Model\Test\PayoneObjectManager; |
|
35
|
|
|
|
|
36
|
|
|
class ForwardingTest extends BaseTestCase |
|
37
|
|
|
{ |
|
38
|
|
|
/** |
|
39
|
|
|
* @var ClassToTest |
|
40
|
|
|
*/ |
|
41
|
|
|
private $classToTest; |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* @var ObjectManager|PayoneObjectManager |
|
45
|
|
|
*/ |
|
46
|
|
|
private $objectManager; |
|
47
|
|
|
|
|
48
|
|
|
protected function setUp() |
|
49
|
|
|
{ |
|
50
|
|
|
$this->objectManager = $this->getObjectManager(); |
|
51
|
|
|
|
|
52
|
|
|
$forwarding = [['txaction' => ['appointed', 'paid'], 'url' => 'http://testdomain.com', 'timeout' => 0]]; |
|
53
|
|
|
|
|
54
|
|
|
$configHelper = $this->getMockBuilder(Config::class)->disableOriginalConstructor()->getMock(); |
|
55
|
|
|
$configHelper->method('getForwardingUrls')->willReturn($forwarding); |
|
56
|
|
|
|
|
57
|
|
|
$curl = $this->getMockBuilder(Curl::class)->disableOriginalConstructor()->getMock(); |
|
58
|
|
|
|
|
59
|
|
|
$this->classToTest = $this->objectManager->getObject(ClassToTest::class, [ |
|
60
|
|
|
'configHelper' => $configHelper, |
|
61
|
|
|
'curl' => $curl |
|
62
|
|
|
]); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
public function testHandleForwardings() |
|
66
|
|
|
{ |
|
67
|
|
|
$post = ['txid' => '12345', 'txaction' => 'appointed']; |
|
68
|
|
|
|
|
69
|
|
|
$result = $this->classToTest->handleForwardings($post); |
|
|
|
|
|
|
70
|
|
|
$this->assertNull($result); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|
This check looks for function or method calls that always return null and whose return value is assigned to a variable.
The method
getObject()can return nothing but null, so it makes no sense to assign that value to a variable.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.