mirror of
https://github.com/silverstripe/silverstripe-cms
synced 2024-10-22 08:05:56 +02:00
Merge pull request #1900 from robbieaverill/pulls/4.0/fix-cmsmain-injection-in-tests
FIX Use injection for CMSMain in tests
This commit is contained in:
commit
dd10aadddb
@ -248,7 +248,7 @@ class CMSMainTest extends FunctionalTest
|
||||
$page1->publishRecursive();
|
||||
$page1->delete();
|
||||
|
||||
$cmsMain = new CMSMain();
|
||||
$cmsMain = CMSMain::create();
|
||||
$cmsMain->setRequest(Controller::curr()->getRequest());
|
||||
|
||||
// Bad calls
|
||||
@ -424,7 +424,7 @@ class CMSMainTest extends FunctionalTest
|
||||
|
||||
public function testGetNewItem()
|
||||
{
|
||||
$controller = new CMSMain();
|
||||
$controller = CMSMain::create();
|
||||
$controller->setRequest(Controller::curr()->getRequest());
|
||||
$id = 'new-Page-0';
|
||||
|
||||
@ -450,7 +450,7 @@ class CMSMainTest extends FunctionalTest
|
||||
*/
|
||||
public function testGetList()
|
||||
{
|
||||
$controller = new CMSMain();
|
||||
$controller = CMSMain::create();
|
||||
$controller->setRequest(Controller::curr()->getRequest());
|
||||
|
||||
// Test all pages (stage)
|
||||
@ -543,7 +543,7 @@ class CMSMainTest extends FunctionalTest
|
||||
|
||||
// Get a associated with a fixture page.
|
||||
$page = $this->objFromFixture(Page::class, 'page1');
|
||||
$controller = new CMSMain();
|
||||
$controller = CMSMain::create();
|
||||
$controller->setRequest(Controller::curr()->getRequest());
|
||||
$form = $controller->getEditForm($page->ID);
|
||||
$this->assertInstanceOf("SilverStripe\\Forms\\Form", $form);
|
||||
@ -560,7 +560,7 @@ class CMSMainTest extends FunctionalTest
|
||||
public function testChangeClass()
|
||||
{
|
||||
$this->logInWithPermission('ADMIN');
|
||||
$cms = new CMSMain();
|
||||
$cms = CMSMain::create();
|
||||
$cms->setRequest(Controller::curr()->getRequest());
|
||||
$page = new CMSMainTest_ClassA();
|
||||
$page->Title = 'Class A';
|
||||
|
Loading…
Reference in New Issue
Block a user