-
Notifications
You must be signed in to change notification settings - Fork 7
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 #104 from kschroeder/master
Added check payment method
- Loading branch information
Showing
10 changed files
with
101 additions
and
10 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
46 changes: 46 additions & 0 deletions
46
lib/Magento/Actions/Checkout/PaymentMethods/CheckMoneyOrder.php
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,46 @@ | ||
<?php | ||
|
||
namespace Magium\Magento\Actions\Checkout\PaymentMethods; | ||
|
||
use Magium\Magento\AbstractMagentoTestCase; | ||
use Magium\WebDriver\WebDriver; | ||
|
||
class CheckMoneyOrder implements PaymentMethodInterface | ||
{ | ||
|
||
const ACTION = 'Checkout\PaymentMethods\CheckMoneyOrder'; | ||
|
||
protected $webDriver; | ||
protected $testCase; | ||
|
||
public function __construct( | ||
WebDriver $webDriver, | ||
AbstractMagentoTestCase $testCase | ||
) { | ||
$this->webDriver = $webDriver; | ||
$this->testCase = $testCase; | ||
} | ||
|
||
public function getId() | ||
{ | ||
return 'p_method_checkmo'; | ||
} | ||
|
||
/** | ||
* Fills in the payment form, selecting it, if necessary | ||
* | ||
* @param $requirePayment | ||
*/ | ||
|
||
public function pay($requirePayment) | ||
{ | ||
if ($requirePayment) { | ||
$this->testCase->assertElementExists($this->getId()); | ||
} | ||
|
||
if ($this->webDriver->elementDisplayed($this->getId())) { | ||
$element = $this->webDriver->byId($this->getId()); | ||
$this->webDriver->getMouse()->click($element->getCoordinates()); | ||
} | ||
} | ||
} |
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,32 @@ | ||
<?php | ||
|
||
namespace Tests\Magium\Magento\Checkout; | ||
|
||
use Magium\Magento\AbstractMagentoTestCase; | ||
use Magium\Magento\Actions\Admin\Configuration\Enabler; | ||
use Magium\Magento\Actions\Admin\Login\Login; | ||
use Magium\Magento\Actions\Cart\AddItemToCart; | ||
use Magium\Magento\Actions\Checkout\GuestCheckout; | ||
|
||
class CheckMoneyOrderPaymentTest extends AbstractMagentoTestCase | ||
{ | ||
|
||
public function testCheckMoneyOrder() | ||
{ | ||
$this->getAction(Login::ACTION)->login(); | ||
$this->getAction(Enabler::ACTION)->enable('Payment Methods/Check / Money Order'); | ||
|
||
$this->commandOpen($this->getTheme()->getBaseUrl()); | ||
$this->getAction(AddItemToCart::ACTION)->addSimpleProductToCartFromCategoryPage(); | ||
$this->setPaymentMethod('CheckMoneyOrder'); | ||
$this->getAction(GuestCheckout::ACTION)->execute(); | ||
} | ||
|
||
protected function tearDown() | ||
{ | ||
$this->getAction(Login::ACTION)->login(); | ||
$this->getAction(Enabler::ACTION)->disable('Payment Methods/Check / Money Order'); | ||
parent::tearDown(); | ||
} | ||
|
||
} |
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