Skip to content

Commit

Permalink
Fix OrderProcessor using the wrong config.
Browse files Browse the repository at this point in the history
Minor improvement in unit-test that resets any existing config in OrderEmailNotifierTest
  • Loading branch information
bummzack committed Feb 23, 2018
1 parent 48fdf81 commit 431c781
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/Checkout/OrderProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 11,7 @@
use SilverShop\ShopTools;
use SilverStripe\Control\Controller;
use SilverStripe\Core\Config\Config_ForClass;
use SilverStripe\Core\Config\Configurable;
use SilverStripe\Core\Injector\Injectable;
use SilverStripe\Omnipay\GatewayInfo;
use SilverStripe\Omnipay\Model\Payment;
Expand All @@ -30,6 31,7 @@
class OrderProcessor
{
use Injectable;
use Configurable;

/**
* @var Order
Expand Down Expand Up @@ -401,9 403,4 @@ protected function error($message)
{
$this->error = $message;
}

public static function config()
{
return new Config_ForClass("OrderProcessor");
}
}
3 changes: 3 additions & 0 deletions tests/php/Checkout/OrderEmailNotifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 3,7 @@
namespace SilverShop\Tests\Checkout;

use SilverShop\Checkout\OrderEmailNotifier;
use SilverShop\Extension\ShopConfigExtension;
use SilverShop\Model\Order;
use SilverStripe\Control\Email\Email;
use SilverStripe\Core\Config\Config;
Expand All @@ -29,6 30,8 @@ public function setUp()
{
parent::setUp();
Config::modify()->set(Email::class, 'admin_email', '[email protected]');
// clear any setting that might have been made via shop-config
Config::modify()->remove(ShopConfigExtension::class, 'email_from');
$this->order = $this->objFromFixture(Order::class, 'paid');
$this->notifier = OrderEmailNotifier::create($this->order);
}
Expand Down

0 comments on commit 431c781

Please sign in to comment.