-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #189 from michielgerritsen/bugfix/order-free-products
Bugfix: It is now possible to order free products that have a shipping price
- Loading branch information
Showing
22 changed files
with
144 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?php | ||
|
||
namespace Mollie\Payment\Test\Integration\Model; | ||
|
||
use Mollie\Payment\Model\MollieConfigProvider; | ||
use Mollie\Payment\Test\Integration\IntegrationTestCase; | ||
|
||
class MollieConfigProviderTest extends IntegrationTestCase | ||
{ | ||
/** | ||
* @magentoConfigFixture default_store payment/mollie_general/enabled 1 | ||
* @magentoConfigFixture default_store payment/mollie_general/apikey_test test_TEST_API_KEY | ||
* @magentoConfigFixture default_store payment/mollie_general/type test | ||
* | ||
* @magentoConfigFixture default_store payment/mollie_methods_bancontact/active 1 | ||
* @magentoConfigFixture default_store payment/mollie_methods_bancontact/active 1 | ||
* @magentoConfigFixture default_store payment/mollie_methods_banktransfer/active 1 | ||
* @magentoConfigFixture default_store payment/mollie_methods_belfius/active 1 | ||
* @magentoConfigFixture default_store payment/mollie_methods_creditcard/active 1 | ||
* @magentoConfigFixture default_store payment/mollie_methods_paypal/active 1 | ||
* @magentoConfigFixture default_store payment/mollie_methods_paysafecard/active 1 | ||
* @magentoConfigFixture default_store payment/mollie_methods_sofort/active 1 | ||
* @magentoConfigFixture default_store payment/mollie_methods_inghomepay/active 1 | ||
* @magentoConfigFixture default_store payment/mollie_methods_giropay/active 1 | ||
* @magentoConfigFixture default_store payment/mollie_methods_eps/active 1 | ||
* @magentoConfigFixture default_store payment/mollie_methods_klarnapaylater/active 1 | ||
* @magentoConfigFixture default_store payment/mollie_methods_klarnasliceit/active 1 | ||
* @magentoConfigFixture default_store payment/mollie_methods_przelewy24/active 1 | ||
* @magentoConfigFixture default_store payment/mollie_methods_applepay/active 1 | ||
* @magentoConfigFixture default_store payment/mollie_methods_ideal/active 1 | ||
* @magentoConfigFixture default_store payment/mollie_methods_kbc/active 1 | ||
* @magentoConfigFixture default_store payment/mollie_methods_giftcard/active 1 | ||
*/ | ||
public function testGetConfig() | ||
{ | ||
/** @var MollieConfigProvider $instance */ | ||
$instance = $this->objectManager->get(MollieConfigProvider::class); | ||
|
||
$result = $instance->getConfig(); | ||
|
||
$this->assertCount(17, $result['payment']['instructions']); | ||
$this->assertCount(17, $result['payment']['image']); | ||
|
||
$this->assertArrayHasKey('mollie_methods_ideal', $result['payment']['issuersListType']); | ||
$this->assertArrayHasKey('mollie_methods_kbc', $result['payment']['issuersListType']); | ||
$this->assertArrayHasKey('mollie_methods_giftcard', $result['payment']['issuersListType']); | ||
|
||
$this->assertEquals([], $result['payment']['issuers']['mollie_methods_ideal']); | ||
$this->assertEquals([], $result['payment']['issuers']['mollie_methods_kbc']); | ||
$this->assertEquals([], $result['payment']['issuers']['mollie_methods_giftcard']); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<?php | ||
|
||
namespace Mollie\Payment\Test\Unit\Model; | ||
|
||
use Mollie\Payment\Helper\General; | ||
use Mollie\Payment\Model\MollieConfigProvider; | ||
use Mollie\Payment\Test\Unit\UnitTestCase; | ||
|
||
class MollieConfigProviderTest extends UnitTestCase | ||
{ | ||
public function testCallsTheApiOnlyOnce() | ||
{ | ||
$client = new \Mollie\Api\MollieApiClient; | ||
|
||
$methodsEndpointMock = $this->createMock(\Mollie\Api\Endpoints\MethodEndpoint::class); | ||
$methodsEndpointMock->expects($this->once())->method('all')->willReturn([ | ||
(object)[ | ||
'id' => 'ideal', | ||
'image' => (object)[ | ||
'size2x' => 'ideal.png', | ||
] | ||
] | ||
]); | ||
$client->methods = $methodsEndpointMock; | ||
|
||
/** @var MollieConfigProvider $instance */ | ||
$instance = $this->objectManager->getObject(MollieConfigProvider::class); | ||
|
||
$result = $instance->getActiveMethods($client); | ||
$this->assertTrue(is_array($result)); | ||
$this->assertArrayHasKey('mollie_methods_ideal', $result); | ||
$this->assertEquals('ideal.png', $result['mollie_methods_ideal']['image']); | ||
|
||
$result = $instance->getActiveMethods($client); | ||
$this->assertTrue(is_array($result)); | ||
$this->assertArrayHasKey('mollie_methods_ideal', $result); | ||
$this->assertEquals('ideal.png', $result['mollie_methods_ideal']['image']); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters