Skip to content

Commit

Permalink
Merge pull request #145 from michielgerritsen/feature/methods-test
Browse files Browse the repository at this point in the history
Feature/methods test
  • Loading branch information
Marvin-Magmodules authored May 28, 2019
2 parents ad4f014 + 3290871 commit d527864
Show file tree
Hide file tree
Showing 19 changed files with 215 additions and 6 deletions.
15 changes: 10 additions & 5 deletions Tests/Unit/Model/Methods/AbstractMethodTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Mollie\Api\Resources\Method;
use Mollie\Api\Endpoints\MethodEndpoint;
use Mollie\Api\Resources\MethodCollection;
use Mollie\Payment\Model\Methods\ApplePay;
use Mollie\Payment\Model\MollieConfigProvider;
use Mollie\Payment\Helper\General as MollieHelper;
use Magento\Framework\App\Config\ScopeConfigInterface;
Expand Down Expand Up @@ -53,7 +52,7 @@ public function testHasTheCorrectCode()
$reflection = new \ReflectionClass($this->instance);
$instance = $reflection->newInstanceWithoutConstructor();

$this->assertEquals($this->code, $instance->getCode());
$this->assertEquals('mollie_methods_' . $this->code, $instance->getCode());
}

public function testIsListedAsActiveMethod()
Expand All @@ -72,14 +71,19 @@ public function testIsListedAsActiveMethod()

$methods = $helper->getAllActiveMethods(1);

$this->assertArrayHasKey($this->code, $methods);
if ($this->code == 'paymentlink') {
$this->assertArrayNotHasKey('mollie_methods_' . $this->code, $methods);
return;
}

$this->assertArrayHasKey('mollie_methods_' . $this->code, $methods);
}

public function testThatTheMethodIsActive()
{
/** @var Method $method */
$method = $this->objectManager->getObject(Method::class);
$method->id = 'applepay';
$method->id = $this->code;
$method->image = new \stdClass;
$method->image->size2x = 'http://www.example.com/image.png';

Expand All @@ -95,6 +99,7 @@ public function testThatTheMethodIsActive()
$instance = $this->objectManager->getObject(MollieConfigProvider::class);
$methods = $instance->getActiveMethods($mollieApiClient);

$this->assertArrayHasKey($this->code, $methods);
$this->assertArrayHasKey('mollie_methods_' . $this->code, $methods);
$this->assertEquals($method->image->size2x, $methods['mollie_methods_' . $this->code]['image']);
}
}
2 changes: 1 addition & 1 deletion Tests/Unit/Model/Methods/ApplePayTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ApplePayTest extends AbstractMethodTest
{
protected $instance = ApplePay::class;

protected $code = 'mollie_methods_applepay';
protected $code = 'applepay';

public function testTheIncludeWalletsParameterIsUsed()
{
Expand Down
12 changes: 12 additions & 0 deletions Tests/Unit/Model/Methods/BancontactTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Tests\Unit\Model\Methods\AbstractMethodTest;

class BancontactTest extends AbstractMethodTest
{
protected $instance = Bancontact::class;

protected $code = 'bancontact';
}
12 changes: 12 additions & 0 deletions Tests/Unit/Model/Methods/BanktransferTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Tests\Unit\Model\Methods\AbstractMethodTest;

class BanktransferTest extends AbstractMethodTest
{
protected $instance = Banktransfer::class;

protected $code = 'banktransfer';
}
12 changes: 12 additions & 0 deletions Tests/Unit/Model/Methods/BelfiusTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Tests\Unit\Model\Methods\AbstractMethodTest;

class BelfiusTest extends AbstractMethodTest
{
protected $instance = Belfius::class;

protected $code = 'belfius';
}
12 changes: 12 additions & 0 deletions Tests/Unit/Model/Methods/CreditcardTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Tests\Unit\Model\Methods\AbstractMethodTest;

class CreditcardTest extends AbstractMethodTest
{
protected $instance = Creditcard::class;

protected $code = 'creditcard';
}
12 changes: 12 additions & 0 deletions Tests/Unit/Model/Methods/EpsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Tests\Unit\Model\Methods\AbstractMethodTest;

class EpsTest extends AbstractMethodTest
{
protected $instance = Eps::class;

protected $code = 'eps';
}
12 changes: 12 additions & 0 deletions Tests/Unit/Model/Methods/GiftcardTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Tests\Unit\Model\Methods\AbstractMethodTest;

class GiftcardTest extends AbstractMethodTest
{
protected $instance = Giftcard::class;

protected $code = 'giftcard';
}
12 changes: 12 additions & 0 deletions Tests/Unit/Model/Methods/GiropayTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Tests\Unit\Model\Methods\AbstractMethodTest;

class GiropayTest extends AbstractMethodTest
{
protected $instance = Giropay::class;

protected $code = 'giropay';
}
12 changes: 12 additions & 0 deletions Tests/Unit/Model/Methods/IdealTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Tests\Unit\Model\Methods\AbstractMethodTest;

class IdealTest extends AbstractMethodTest
{
protected $instance = Ideal::class;

protected $code = 'ideal';
}
12 changes: 12 additions & 0 deletions Tests/Unit/Model/Methods/InghomepayTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Tests\Unit\Model\Methods\AbstractMethodTest;

class InghomepayTest extends AbstractMethodTest
{
protected $instance = Inghomepay::class;

protected $code = 'inghomepay';
}
12 changes: 12 additions & 0 deletions Tests/Unit/Model/Methods/KbcTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Tests\Unit\Model\Methods\AbstractMethodTest;

class KbcTest extends AbstractMethodTest
{
protected $instance = Kbc::class;

protected $code = 'kbc';
}
12 changes: 12 additions & 0 deletions Tests/Unit/Model/Methods/KlarnapaylaterTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Tests\Unit\Model\Methods\AbstractMethodTest;

class KlarnapaylaterTest extends AbstractMethodTest
{
protected $instance = Klarnapaylater::class;

protected $code = 'klarnapaylater';
}
12 changes: 12 additions & 0 deletions Tests/Unit/Model/Methods/KlarnasliceitTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Tests\Unit\Model\Methods\AbstractMethodTest;

class KlarnasliceitTest extends AbstractMethodTest
{
protected $instance = Klarnasliceit::class;

protected $code = 'klarnasliceit';
}
12 changes: 12 additions & 0 deletions Tests/Unit/Model/Methods/PaymentlinkTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Tests\Unit\Model\Methods\AbstractMethodTest;

class PaymentlinkTest extends AbstractMethodTest
{
protected $instance = Paymentlink::class;

protected $code = 'paymentlink';
}
12 changes: 12 additions & 0 deletions Tests/Unit/Model/Methods/PaypalTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Tests\Unit\Model\Methods\AbstractMethodTest;

class PaypalTest extends AbstractMethodTest
{
protected $instance = Paypal::class;

protected $code = 'paypal';
}
12 changes: 12 additions & 0 deletions Tests/Unit/Model/Methods/PaysafecardTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Tests\Unit\Model\Methods\AbstractMethodTest;

class PaysafecardTest extends AbstractMethodTest
{
protected $instance = Paysafecard::class;

protected $code = 'paysafecard';
}
12 changes: 12 additions & 0 deletions Tests/Unit/Model/Methods/Przelewy24Test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Tests\Unit\Model\Methods\AbstractMethodTest;

class Przelewy24Test extends AbstractMethodTest
{
protected $instance = Przelewy24::class;

protected $code = 'przelewy24';
}
12 changes: 12 additions & 0 deletions Tests/Unit/Model/Methods/SofortTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace Mollie\Payment\Model\Methods;

use Mollie\Payment\Tests\Unit\Model\Methods\AbstractMethodTest;

class SofortTest extends AbstractMethodTest
{
protected $instance = Sofort::class;

protected $code = 'sofort';
}

0 comments on commit d527864

Please sign in to comment.