mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
f4eecd4d0d
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@75903 467b73ca-7a2a-4603-9d3b-597d59a354a9
50 lines
1.6 KiB
PHP
50 lines
1.6 KiB
PHP
<?php
|
|
|
|
class VirtualPageTest extends SapphireTest {
|
|
static $fixture_file = 'sapphire/tests/model/VirtualPageTest.yml';
|
|
|
|
/**
|
|
* Test that, after you update the source page of a virtual page, all the virtual pages
|
|
* are updated
|
|
*/
|
|
function testEditingSourcePageUpdatesVirtualPages() {
|
|
$master = $this->objFromFixture('Page', 'master');
|
|
$master->Title = "New title";
|
|
$master->Content = "<p>New content</p>";
|
|
$master->write();
|
|
|
|
$vp1 = $this->objFromFixture('VirtualPage', 'vp1');
|
|
$vp2 = $this->objFromFixture('VirtualPage', 'vp2');
|
|
|
|
$this->assertEquals("New title", $vp1->Title);
|
|
$this->assertEquals("New title", $vp2->Title);
|
|
$this->assertEquals("<p>New content</p>", $vp1->Content);
|
|
$this->assertEquals("<p>New content</p>", $vp2->Content);
|
|
}
|
|
|
|
/**
|
|
* Test that, after you publish the source page of a virtual page, all the virtual pages
|
|
* are published
|
|
*/
|
|
function testPublishingSourcePagePublishesVirtualPages() {
|
|
$master = $this->objFromFixture('Page', 'master');
|
|
$master->Title = "New title";
|
|
$master->Content = "<p>New content</p>";
|
|
$master->write();
|
|
$master->doPublish();
|
|
|
|
Versioned::reading_stage("Live");
|
|
$vp1 = DataObject::get_by_id("VirtualPage", $this->idFromFixture('VirtualPage', 'vp1'));
|
|
$vp2 = DataObject::get_by_id("VirtualPage", $this->idFromFixture('VirtualPage', 'vp2'));
|
|
|
|
$this->assertNotNull($vp1);
|
|
$this->assertNotNull($vp2);
|
|
|
|
$this->assertEquals("New title", $vp1->Title);
|
|
$this->assertEquals("New title", $vp2->Title);
|
|
$this->assertEquals("<p>New content</p>", $vp1->Content);
|
|
$this->assertEquals("<p>New content</p>", $vp2->Content);
|
|
Versioned::reading_stage("Stage");
|
|
}
|
|
|
|
} |