| @@ 848-864 (lines=17) @@ | ||
| 845 | * @expectedException \eZ\Publish\Core\Persistence\Legacy\Exception\RemoveLastGroupFromType |
|
| 846 | * @expectedExceptionMessage Type with ID "23" in status "1" cannot be unlinked from its last group. |
|
| 847 | */ |
|
| 848 | public function testUnlinkFailure() |
|
| 849 | { |
|
| 850 | $gatewayMock = $this->getGatewayMock(); |
|
| 851 | $gatewayMock->expects($this->once()) |
|
| 852 | ->method('countGroupsForType') |
|
| 853 | ->with( |
|
| 854 | $this->equalTo(23), |
|
| 855 | $this->equalTo(1) |
|
| 856 | ) |
|
| 857 | // Only 1 group assigned |
|
| 858 | ->will($this->returnValue(1)); |
|
| 859 | ||
| 860 | $mapperMock = $this->getMapperMock(); |
|
| 861 | ||
| 862 | $handler = $this->getHandler(); |
|
| 863 | $res = $handler->unlink(3, 23, 1); |
|
| 864 | } |
|
| 865 | ||
| 866 | /** |
|
| 867 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Handler::getFieldDefinition |
|
| @@ 1390-1405 (lines=16) @@ | ||
| 1387 | /** |
|
| 1388 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Handler::setStatus |
|
| 1389 | */ |
|
| 1390 | public function testSetStatus() |
|
| 1391 | { |
|
| 1392 | $handler = $this->getContentHandler(); |
|
| 1393 | ||
| 1394 | $mapperMock = $this->getMapperMock(); |
|
| 1395 | $gatewayMock = $this->getGatewayMock(); |
|
| 1396 | ||
| 1397 | $gatewayMock->expects($this->once()) |
|
| 1398 | ->method('setStatus') |
|
| 1399 | ->with(23, 5, 2) |
|
| 1400 | ->will($this->returnValue(true)); |
|
| 1401 | ||
| 1402 | $this->assertTrue( |
|
| 1403 | $handler->setStatus(23, 2, 5) |
|
| 1404 | ); |
|
| 1405 | } |
|
| 1406 | ||
| 1407 | /** |
|
| 1408 | * Returns the handler to test. |
|