| @@ 93-112 (lines=20) @@ | ||
| 90 | $this->assertEquals(array('stub'), $objects->column('Title')); |
|
| 91 | } |
|
| 92 | ||
| 93 | public function testObjectsToUpdateOnPublishIfVirtualExists() |
|
| 94 | { |
|
| 95 | $redir = PublishablePage::create(); |
|
| 96 | $redir->Title = 'virtual'; |
|
| 97 | ||
| 98 | $stub = $this->getMockBuilder(PublishablePage::class) |
|
| 99 | ->setMethods(array('getMyVirtualPages')) |
|
| 100 | ->getMock(); |
|
| 101 | ||
| 102 | $stub->Title = 'stub'; |
|
| 103 | ||
| 104 | $stub->expects($this->once()) |
|
| 105 | ->method('getMyVirtualPages') |
|
| 106 | ->will( |
|
| 107 | $this->returnValue( |
|
| 108 | new ArrayList(array($redir)) |
|
| 109 | ) |
|
| 110 | ); |
|
| 111 | ||
| 112 | $objects = $stub->objectsToUpdate(array('action' => 'publish')); |
|
| 113 | $this->assertContains('virtual', $objects->column('Title')); |
|
| 114 | } |
|
| 115 | ||
| @@ 116-135 (lines=20) @@ | ||
| 113 | $this->assertContains('virtual', $objects->column('Title')); |
|
| 114 | } |
|
| 115 | ||
| 116 | public function testObjectsToDeleteOnUnpublishIfVirtualExists() |
|
| 117 | { |
|
| 118 | $redir = PublishablePage::create(); |
|
| 119 | $redir->Title = 'virtual'; |
|
| 120 | ||
| 121 | $stub = $this->getMockBuilder(PublishablePage::class) |
|
| 122 | ->setMethods(array('getMyVirtualPages')) |
|
| 123 | ->getMock(); |
|
| 124 | ||
| 125 | $stub->Title = 'stub'; |
|
| 126 | ||
| 127 | $stub->expects($this->once()) |
|
| 128 | ->method('getMyVirtualPages') |
|
| 129 | ->will( |
|
| 130 | $this->returnValue( |
|
| 131 | new ArrayList(array($redir)) |
|
| 132 | ) |
|
| 133 | ); |
|
| 134 | ||
| 135 | $objects = $stub->objectsToDelete(array('action' => 'unpublish')); |
|
| 136 | $this->assertContains('virtual', $objects->column('Title')); |
|
| 137 | } |
|
| 138 | } |
|