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