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