BUGFIX Using _t() to check content strings in unit tests and avoid tests failing when i18n is enabled

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@64042 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-10-10 02:20:33 +00:00
parent 9b86763720
commit 2b15a2d5b5
2 changed files with 6 additions and 6 deletions

View File

@ -18,13 +18,13 @@ class RedirectorPageTest extends FunctionalTest {
/* An error message will be shown if you visit it */
$content = $this->get(Director::makeRelative($page1->Link()))->getBody();
$this->assertContains("A redirector page has been set up without anywhere to redirect to.", $content);
$this->assertContains(_t('RedirectorPage.HASBEENSETUP'), $content);
/* This also applies for internal links */
$page2 = $this->objFromFixture('RedirectorPage','badinternal');
$this->assertEquals(Director::baseURL() . 'bad-internal/', $page2->Link());
$content = $this->get(Director::makeRelative($page2->Link()))->getBody();
$this->assertContains("A redirector page has been set up without anywhere to redirect to.", $content);
$this->assertContains(_t('RedirectorPage.HASBEENSETUP'), $content);
}
function testReflexiveAndTransitiveInternalRedirectors() {
@ -32,7 +32,7 @@ class RedirectorPageTest extends FunctionalTest {
$page = $this->objFromFixture('RedirectorPage','reflexive');
$this->assertEquals(Director::baseURL() . 'reflexive/', $page->Link());
$content = $this->get(Director::makeRelative($page->Link()))->getBody();
$this->assertContains("A redirector page has been set up without anywhere to redirect to.", $content);
$this->assertContains(_t('RedirectorPage.HASBEENSETUP'), $content);
/* Transitive redirectors are those that point to another redirector page. They should send people to the URLSegment
* of the destination page - the middle-stop, so to speak. That should redirect to the final destination */

View File

@ -72,7 +72,7 @@ class SecurityTest extends FunctionalTest {
/* THE FIRST 4 TIMES, THE MEMBER SHOULDN'T BE LOCKED OUT */
if($i < 5) {
$this->assertNull($member->LockedOutUntil);
$this->assertTrue(false !== stripos($this->loginErrorMessage(), "That doesn't seem to be the right e-mail address or password"));
$this->assertTrue(false !== stripos($this->loginErrorMessage(), _t('Member.ERRORWRONGCRED')));
}
/* AFTER THAT THE USER IS LOCKED OUT FOR 15 MINUTES */
@ -83,7 +83,7 @@ class SecurityTest extends FunctionalTest {
}
if($i > 5) {
$this->assertTrue(false !== stripos($this->loginErrorMessage(), "Your account has been temporarily disabled"));
$this->assertTrue(false !== stripos($this->loginErrorMessage(), _t('Member.ERRORLOCKEDOUT')));
}
}
@ -112,7 +112,7 @@ class SecurityTest extends FunctionalTest {
$this->doTestLoginForm('sam@silverstripe.com' , 'incorrectpassword');
$this->doTestLoginForm('sam@silverstripe.com' , 'incorrectpassword');
$this->assertNull($this->session()->inst_get('loggedInAs'));
$this->assertTrue(false !== stripos($this->loginErrorMessage(), "That doesn't seem to be the right e-mail address or password"));
$this->assertTrue(false !== stripos($this->loginErrorMessage(), _t('Member.ERRORWRONGCRED')));
$this->doTestLoginForm('sam@silverstripe.com' , '1nitialPassword');
$this->assertEquals($this->session()->inst_get('loggedInAs'), $member->ID);