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