(merged from branches/roa. use "svn log -c <changeset> -g <module-svn-path>" for detailed commit message)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60354 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2008-08-11 03:42:59 +00:00
parent ac527ee8ed
commit 46417f5d8a
2 changed files with 24 additions and 1 deletions

View File

@ -130,7 +130,7 @@ class SQLQuery extends Object {
* @return SQLQuery This instance
*/
public function from($table) {
$this->from[] = $table;
$this->from[str_replace('`','',$table)] = $table;
return $this;
}

View File

@ -61,6 +61,29 @@ class SiteTreeTest extends SapphireTest {
$this->assertType('SiteTreeTest_PageNode', $child->Parent);
}
/**
* Confirm that DataObject::get_one() gets records from SiteTree_Live
*/
function testGetOneFromLive() {
$s = new SiteTree();
$s->Title = "V1";
$s->URLSegment = "get-one-test-page";
$s->write();
$s->publish("Stage", "Live");
$s->Title = "V2";
$s->write();
$oldStage = Versioned::current_stage();
Versioned::reading_stage('Live');
$checkSiteTree = DataObject::get_one("SiteTree", "URLSegment = 'get-one-test-page'");
$this->assertEquals("V1", $checkSiteTree->Title);
}
/**
* Test that saving changes creates a new version with the correct data in it.
*/
}
class SiteTreeTest_PageNode extends SiteTree implements TestOnly { }