| @@ 32-57 (lines=26) @@ | ||
| 29 | use Payone\Core\Helper\Connection\CurlCli; |
|
| 30 | use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; |
|
| 31 | ||
| 32 | class CurlCliTest extends \PHPUnit_Framework_TestCase |
|
| 33 | { |
|
| 34 | /** |
|
| 35 | * @var ObjectManager |
|
| 36 | */ |
|
| 37 | private $objectManager; |
|
| 38 | ||
| 39 | /** |
|
| 40 | * @var CurlCli |
|
| 41 | */ |
|
| 42 | private $curlCli; |
|
| 43 | ||
| 44 | protected function setUp() |
|
| 45 | { |
|
| 46 | $this->objectManager = new ObjectManager($this); |
|
| 47 | ||
| 48 | $this->curlCli = $this->objectManager->getObject(CurlCli::class); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function testIsApplicable() |
|
| 52 | { |
|
| 53 | $result = $this->curlCli->isApplicable(); |
|
| 54 | $expected = (file_exists("/usr/local/bin/curl") || file_exists("/usr/bin/curl")); |
|
| 55 | $this->assertEquals($expected, $result); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| @@ 32-57 (lines=26) @@ | ||
| 29 | use Payone\Core\Helper\Connection\CurlPhp; |
|
| 30 | use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; |
|
| 31 | ||
| 32 | class CurlPhpTest extends \PHPUnit_Framework_TestCase |
|
| 33 | { |
|
| 34 | /** |
|
| 35 | * @var ObjectManager |
|
| 36 | */ |
|
| 37 | private $objectManager; |
|
| 38 | ||
| 39 | /** |
|
| 40 | * @var CurlPhp |
|
| 41 | */ |
|
| 42 | private $curlPhp; |
|
| 43 | ||
| 44 | protected function setUp() |
|
| 45 | { |
|
| 46 | $this->objectManager = new ObjectManager($this); |
|
| 47 | ||
| 48 | $this->curlPhp = $this->objectManager->getObject(CurlPhp::class); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function testIsApplicable() |
|
| 52 | { |
|
| 53 | $result = $this->curlPhp->isApplicable(); |
|
| 54 | $expected = (function_exists("curl_init")); |
|
| 55 | $this->assertEquals($expected, $result); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||
| @@ 32-57 (lines=26) @@ | ||
| 29 | use Payone\Core\Helper\Connection\Fsockopen; |
|
| 30 | use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; |
|
| 31 | ||
| 32 | class FsockopenTest extends \PHPUnit_Framework_TestCase |
|
| 33 | { |
|
| 34 | /** |
|
| 35 | * @var ObjectManager |
|
| 36 | */ |
|
| 37 | private $objectManager; |
|
| 38 | ||
| 39 | /** |
|
| 40 | * @var Fsockopen |
|
| 41 | */ |
|
| 42 | private $fsockopen; |
|
| 43 | ||
| 44 | protected function setUp() |
|
| 45 | { |
|
| 46 | $this->objectManager = new ObjectManager($this); |
|
| 47 | ||
| 48 | $this->fsockopen = $this->objectManager->getObject(Fsockopen::class); |
|
| 49 | } |
|
| 50 | ||
| 51 | public function testIsApplicable() |
|
| 52 | { |
|
| 53 | $result = $this->fsockopen->isApplicable(); |
|
| 54 | $expected = (function_exists("curl_init")); |
|
| 55 | $this->assertEquals($expected, $result); |
|
| 56 | } |
|
| 57 | } |
|
| 58 | ||