mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
(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:
parent
ac527ee8ed
commit
46417f5d8a
@ -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;
|
||||
}
|
||||
|
@ -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 { }
|
||||
|
Loading…
Reference in New Issue
Block a user