|
@@ 20-42 (lines=23) @@
|
| 17 |
|
parent::tearDown(); |
| 18 |
|
} |
| 19 |
|
|
| 20 |
|
function testObjectsToUpdateOnPublish() { |
| 21 |
|
|
| 22 |
|
$parent = Object::create('PublishableSiteTreeTest_Publishable'); |
| 23 |
|
$parent->Title = 'parent'; |
| 24 |
|
|
| 25 |
|
$stub = $this->getMock( |
| 26 |
|
'PublishableSiteTreeTest_Publishable', |
| 27 |
|
array('getParentID', 'Parent') |
| 28 |
|
); |
| 29 |
|
$stub->Title = 'stub'; |
| 30 |
|
|
| 31 |
|
$stub->expects($this->once()) |
| 32 |
|
->method('getParentID') |
| 33 |
|
->will($this->returnValue('2')); |
| 34 |
|
|
| 35 |
|
$stub->expects($this->once()) |
| 36 |
|
->method('Parent') |
| 37 |
|
->will($this->returnValue($parent)); |
| 38 |
|
|
| 39 |
|
$objects = $stub->objectsToUpdate(array('action' => 'publish')); |
| 40 |
|
$this->assertEquals($objects->column('Title'), array('stub', 'parent'), 'Updates itself and parent on publish'); |
| 41 |
|
|
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
function testObjectsToUpdateOnUnpublish() { |
| 45 |
|
|
|
@@ 44-66 (lines=23) @@
|
| 41 |
|
|
| 42 |
|
} |
| 43 |
|
|
| 44 |
|
function testObjectsToUpdateOnUnpublish() { |
| 45 |
|
|
| 46 |
|
$parent = Object::create('PublishableSiteTreeTest_Publishable'); |
| 47 |
|
$parent->Title = 'parent'; |
| 48 |
|
|
| 49 |
|
$stub = $this->getMock( |
| 50 |
|
'PublishableSiteTreeTest_Publishable', |
| 51 |
|
array('getParentID', 'Parent') |
| 52 |
|
); |
| 53 |
|
$stub->Title = 'stub'; |
| 54 |
|
|
| 55 |
|
$stub->expects($this->once()) |
| 56 |
|
->method('getParentID') |
| 57 |
|
->will($this->returnValue('2')); |
| 58 |
|
|
| 59 |
|
$stub->expects($this->once()) |
| 60 |
|
->method('Parent') |
| 61 |
|
->will($this->returnValue($parent)); |
| 62 |
|
|
| 63 |
|
$objects = $stub->objectsToUpdate(array('action' => 'unpublish')); |
| 64 |
|
$this->assertEquals($objects->column('Title'), array('parent'), 'Updates parent on unpublish'); |
| 65 |
|
|
| 66 |
|
} |
| 67 |
|
|
| 68 |
|
function testObjectsToDeleteOnPublish() { |
| 69 |
|
|