From 1dcaf36c9b5f7b05e1fb63e574e690578c68d19d Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Tue, 22 Apr 2014 13:28:44 +1200 Subject: [PATCH] Fix merge regressions --- tests/control/DirectorTest.php | 4 ++-- tests/model/ImageTest.php | 9 ++++----- tests/security/SecurityTest.php | 8 ++++++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/control/DirectorTest.php b/tests/control/DirectorTest.php index 0d8149c88..b99e00971 100644 --- a/tests/control/DirectorTest.php +++ b/tests/control/DirectorTest.php @@ -42,7 +42,7 @@ class DirectorTest extends SapphireTest { // TODO Remove director rule, currently API doesnt allow this // Remove base URL override (setting to false reverts to default behaviour) - Director::setBaseURL(false); + Config::inst()->update('Director', 'alternate_base_url', false); // Reinstate the original REQUEST_URI after it was modified by some tests $_SERVER['REQUEST_URI'] = self::$originalRequestURI; @@ -80,7 +80,7 @@ class DirectorTest extends SapphireTest { $rootURL = Director::protocolAndHost(); $_SERVER['REQUEST_URI'] = "$rootURL/mysite/sub-page/"; - Director::setBaseURL('/mysite/'); + Config::inst()->update('Director', 'alternate_base_url', '/mysite/'); // Test already absolute url $this->assertEquals($rootURL, Director::absoluteURL($rootURL)); diff --git a/tests/model/ImageTest.php b/tests/model/ImageTest.php index 8b782fec5..982549eac 100644 --- a/tests/model/ImageTest.php +++ b/tests/model/ImageTest.php @@ -11,15 +11,14 @@ class ImageTest extends SapphireTest { protected $origBackend; public function setUp() { - if(get_class($this) == "ImageTest") - $this->skipTest = true; + if(get_class($this) == "ImageTest") $this->skipTest = true; parent::setUp(); + $this->origBackend = Image::get_backend(); + if($this->skipTest) return; - - $this->origBackend = Image::get_backend(); if(!file_exists(ASSETS_PATH)) mkdir(ASSETS_PATH); @@ -34,7 +33,7 @@ class ImageTest extends SapphireTest { } public function tearDown() { - Image::set_backend($this->origBackend); + if($this->origBackend) Image::set_backend($this->origBackend); /* Remove the test files that we've created */ $fileIDs = $this->allFixtureIDs('Image'); diff --git a/tests/security/SecurityTest.php b/tests/security/SecurityTest.php index d1f1ffde2..d8259d599 100644 --- a/tests/security/SecurityTest.php +++ b/tests/security/SecurityTest.php @@ -133,7 +133,9 @@ class SecurityTest extends FunctionalTest { $this->session()->inst_set('SessionForms.MemberLoginForm.Email', 'myuser@silverstripe.com'); Security::config()->remember_username = false; $this->get(Config::inst()->get('Security', 'login_url')); - $items = $this->cssParser()->getBySelector('#MemberLoginForm_LoginForm #Email input.text'); + $items = $this + ->cssParser() + ->getBySelector('#MemberLoginForm_LoginForm #MemberLoginForm_LoginForm_Email'); $this->assertEquals(1, count($items)); $this->assertEmpty((string)$items[0]->attributes()->value); $this->assertEquals('off', (string)$items[0]->attributes()->autocomplete); @@ -145,7 +147,9 @@ class SecurityTest extends FunctionalTest { $this->session()->inst_set('SessionForms.MemberLoginForm.Email', 'myuser@silverstripe.com'); Security::config()->remember_username = true; $this->get(Config::inst()->get('Security', 'login_url')); - $items = $this->cssParser()->getBySelector('#MemberLoginForm_LoginForm #Email input.text'); + $items = $this + ->cssParser() + ->getBySelector('#MemberLoginForm_LoginForm #MemberLoginForm_LoginForm_Email'); $this->assertEquals(1, count($items)); $this->assertEquals('myuser@silverstripe.com', (string)$items[0]->attributes()->value); $this->assertNotEquals('off', (string)$items[0]->attributes()->autocomplete);