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