class SubsiteAdminTest extends SapphireTest { static $fixture_file = 'subsites/tests/SubsiteTest.yml'; function adminLoggedInSession() { return new Session(array( 'loggedInAs' => $this->idFromFixture('Member', 'admin') )); } /** * Test generation of the view */ function testBasicView() { // Open the admin area logged in as admin $response1 = Director::test('admin/subsites/', null, $this->adminLoggedInSession()); // Confirm that this URL gets you the entire page, with the edit form loaded $response2 = Director::test('admin/subsites/show/1', null, $this->adminLoggedInSession()); $this->assertTrue(strpos($response2->getBody(), 'id="Form_EditForm_ID"') !== false, "Testing Form_EditForm_ID exists"); $this->assertTrue(strpos($response2->getBody(), '
exists"); // Confirm that this URL gets you just the form content, with the edit form loaded $response3 = Director::test('admin/subsites/show/1', array('ajax' => 1), $this->adminLoggedInSession()); $this->assertTrue(strpos($response3->getBody(), 'id="Form_EditForm_ID"') !== false, "Testing Form_EditForm_ID exists on ajax page"); $this->assertTrue(strpos($response3->getBody(), '