| @@ 99-132 (lines=34) @@ | ||
| 96 | * @covers eZ\Publish\Core\Persistence\Legacy\Content\Section\Handler::load |
|
| 97 | * @covers eZ\Publish\Core\Persistence\Legacy\Content\Section\Handler::createSectionFromArray |
|
| 98 | */ |
|
| 99 | public function testLoad() |
|
| 100 | { |
|
| 101 | $handler = $this->getSectionHandler(); |
|
| 102 | ||
| 103 | $gatewayMock = $this->getGatewayMock(); |
|
| 104 | ||
| 105 | $gatewayMock->expects($this->once()) |
|
| 106 | ->method('loadSectionData') |
|
| 107 | ->with( |
|
| 108 | $this->equalTo(23) |
|
| 109 | )->will( |
|
| 110 | $this->returnValue( |
|
| 111 | array( |
|
| 112 | array( |
|
| 113 | 'id' => '23', |
|
| 114 | 'identifier' => 'new_section', |
|
| 115 | 'name' => 'New Section', |
|
| 116 | ), |
|
| 117 | ) |
|
| 118 | ) |
|
| 119 | ); |
|
| 120 | ||
| 121 | $sectionRef = new Section(); |
|
| 122 | $sectionRef->id = 23; |
|
| 123 | $sectionRef->name = 'New Section'; |
|
| 124 | $sectionRef->identifier = 'new_section'; |
|
| 125 | ||
| 126 | $result = $handler->load(23); |
|
| 127 | ||
| 128 | $this->assertEquals( |
|
| 129 | $sectionRef, |
|
| 130 | $result |
|
| 131 | ); |
|
| 132 | } |
|
| 133 | ||
| 134 | /** |
|
| 135 | * @covers eZ\Publish\Core\Persistence\Legacy\Content\Section\Handler::loadAll |
|
| @@ 186-219 (lines=34) @@ | ||
| 183 | * @covers eZ\Publish\Core\Persistence\Legacy\Content\Section\Handler::loadByIdentifier |
|
| 184 | * @covers eZ\Publish\Core\Persistence\Legacy\Content\Section\Handler::createSectionFromArray |
|
| 185 | */ |
|
| 186 | public function testLoadByIdentifier() |
|
| 187 | { |
|
| 188 | $handler = $this->getSectionHandler(); |
|
| 189 | ||
| 190 | $gatewayMock = $this->getGatewayMock(); |
|
| 191 | ||
| 192 | $gatewayMock->expects($this->once()) |
|
| 193 | ->method('loadSectionDataByIdentifier') |
|
| 194 | ->with( |
|
| 195 | $this->equalTo('new_section') |
|
| 196 | )->will( |
|
| 197 | $this->returnValue( |
|
| 198 | array( |
|
| 199 | array( |
|
| 200 | 'id' => '23', |
|
| 201 | 'identifier' => 'new_section', |
|
| 202 | 'name' => 'New Section', |
|
| 203 | ), |
|
| 204 | ) |
|
| 205 | ) |
|
| 206 | ); |
|
| 207 | ||
| 208 | $sectionRef = new Section(); |
|
| 209 | $sectionRef->id = 23; |
|
| 210 | $sectionRef->name = 'New Section'; |
|
| 211 | $sectionRef->identifier = 'new_section'; |
|
| 212 | ||
| 213 | $result = $handler->loadByIdentifier('new_section'); |
|
| 214 | ||
| 215 | $this->assertEquals( |
|
| 216 | $sectionRef, |
|
| 217 | $result |
|
| 218 | ); |
|
| 219 | } |
|
| 220 | ||
| 221 | /** |
|
| 222 | * @covers eZ\Publish\Core\Persistence\Legacy\Content\Section\Handler::delete |
|