Skip to content

Commit

Permalink
Add additional session setup to item factory tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mlewis-everley committed Nov 3, 2024
1 parent da949b9 commit 3a6efbb
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions tests/LineItemFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@
namespace SilverCommerce\OrdersAdmin\Tests;

use SilverStripe\i18n\i18n;
use SilverStripe\Control\Session;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\Control\HTTPRequest;
use SilverCommerce\GeoZones\Model\Zone;
use SilverStripe\Core\Injector\Injector;
use SilverStripe\ORM\ValidationException;
use SilverCommerce\TaxAdmin\Model\TaxRate;
use SilverCommerce\OrdersAdmin\Model\LineItem;
Expand All @@ -27,16 +30,19 @@ class LineItemFactoryTest extends SapphireTest
TestCustomisationOption::class
];

/**
* Add some extra functionality on construction
*
* @return void
*/
public function setUp(): void
{
parent::setUp();
// Ensure we setup a session and the current request
$request = new HTTPRequest('GET', '/');
$session = new Session(null);
$session->init($request);
$request->setSession($session);
Injector::inst()
->registerService($request, HTTPRequest::class);

i18n::set_locale('en_GB');

parent::setUp();
}

public function testMakeItem()
Expand Down

0 comments on commit 3a6efbb

Please sign in to comment.