| @@ 867-883 (lines=17) @@ | ||
| 864 | * @expectedException eZ\Publish\Core\Persistence\Legacy\Exception\RemoveLastGroupFromType |
|
| 865 | * @expectedExceptionMessage Type with ID "23" in status "1" cannot be unlinked from its last group. |
|
| 866 | */ |
|
| 867 | public function testUnlinkFailure() |
|
| 868 | { |
|
| 869 | $gatewayMock = $this->getGatewayMock(); |
|
| 870 | $gatewayMock->expects($this->once()) |
|
| 871 | ->method('countGroupsForType') |
|
| 872 | ->with( |
|
| 873 | $this->equalTo(23), |
|
| 874 | $this->equalTo(1) |
|
| 875 | ) |
|
| 876 | // Only 1 group assigned |
|
| 877 | ->will($this->returnValue(1)); |
|
| 878 | ||
| 879 | $mapperMock = $this->getMapperMock(); |
|
| 880 | ||
| 881 | $handler = $this->getHandler(); |
|
| 882 | $res = $handler->unlink(3, 23, 1); |
|
| 883 | } |
|
| 884 | ||
| 885 | /** |
|
| 886 | * @covers eZ\Publish\Core\Persistence\Legacy\Content\Type\Handler::getFieldDefinition |
|
| @@ 1388-1403 (lines=16) @@ | ||
| 1385 | /** |
|
| 1386 | * @covers eZ\Publish\Core\Persistence\Legacy\Content\Handler::setStatus |
|
| 1387 | */ |
|
| 1388 | public function testSetStatus() |
|
| 1389 | { |
|
| 1390 | $handler = $this->getContentHandler(); |
|
| 1391 | ||
| 1392 | $mapperMock = $this->getMapperMock(); |
|
| 1393 | $gatewayMock = $this->getGatewayMock(); |
|
| 1394 | ||
| 1395 | $gatewayMock->expects($this->once()) |
|
| 1396 | ->method('setStatus') |
|
| 1397 | ->with(23, 5, 2) |
|
| 1398 | ->will($this->returnValue(true)); |
|
| 1399 | ||
| 1400 | $this->assertTrue( |
|
| 1401 | $handler->setStatus(23, 2, 5) |
|
| 1402 | ); |
|
| 1403 | } |
|
| 1404 | ||
| 1405 | /** |
|
| 1406 | * Returns the handler to test. |
|