| @@ 39-63 (lines=25) @@ | ||
| 36 | /** |
|
| 37 | * @covers eZ\Publish\Core\Persistence\Legacy\Content\Section\Handler::create |
|
| 38 | */ |
|
| 39 | public function testCreate() |
|
| 40 | { |
|
| 41 | $handler = $this->getSectionHandler(); |
|
| 42 | ||
| 43 | $gatewayMock = $this->getGatewayMock(); |
|
| 44 | ||
| 45 | $gatewayMock->expects($this->once()) |
|
| 46 | ->method('insertSection') |
|
| 47 | ->with( |
|
| 48 | $this->equalTo('New Section'), |
|
| 49 | $this->equalTo('new_section') |
|
| 50 | )->will($this->returnValue(23)); |
|
| 51 | ||
| 52 | $sectionRef = new Section(); |
|
| 53 | $sectionRef->id = 23; |
|
| 54 | $sectionRef->name = 'New Section'; |
|
| 55 | $sectionRef->identifier = 'new_section'; |
|
| 56 | ||
| 57 | $result = $handler->create('New Section', 'new_section'); |
|
| 58 | ||
| 59 | $this->assertEquals( |
|
| 60 | $sectionRef, |
|
| 61 | $result |
|
| 62 | ); |
|
| 63 | } |
|
| 64 | ||
| 65 | /** |
|
| 66 | * @covers eZ\Publish\Core\Persistence\Legacy\Content\Section\Handler::update |
|
| @@ 68-93 (lines=26) @@ | ||
| 65 | /** |
|
| 66 | * @covers eZ\Publish\Core\Persistence\Legacy\Content\Section\Handler::update |
|
| 67 | */ |
|
| 68 | public function testUpdate() |
|
| 69 | { |
|
| 70 | $handler = $this->getSectionHandler(); |
|
| 71 | ||
| 72 | $gatewayMock = $this->getGatewayMock(); |
|
| 73 | ||
| 74 | $gatewayMock->expects($this->once()) |
|
| 75 | ->method('updateSection') |
|
| 76 | ->with( |
|
| 77 | $this->equalTo(23), |
|
| 78 | $this->equalTo('New Section'), |
|
| 79 | $this->equalTo('new_section') |
|
| 80 | ); |
|
| 81 | ||
| 82 | $sectionRef = new Section(); |
|
| 83 | $sectionRef->id = 23; |
|
| 84 | $sectionRef->name = 'New Section'; |
|
| 85 | $sectionRef->identifier = 'new_section'; |
|
| 86 | ||
| 87 | $result = $handler->update(23, 'New Section', 'new_section'); |
|
| 88 | ||
| 89 | $this->assertEquals( |
|
| 90 | $sectionRef, |
|
| 91 | $result |
|
| 92 | ); |
|
| 93 | } |
|
| 94 | ||
| 95 | /** |
|
| 96 | * @covers eZ\Publish\Core\Persistence\Legacy\Content\Section\Handler::load |
|