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