| @@ 852-868 (lines=17) @@ | ||
| 849 | * @expectedException \eZ\Publish\Core\Persistence\Legacy\Exception\RemoveLastGroupFromType |
|
| 850 | * @expectedExceptionMessage Type with ID "23" in status "1" cannot be unlinked from its last group. |
|
| 851 | */ |
|
| 852 | public function testUnlinkFailure() |
|
| 853 | { |
|
| 854 | $gatewayMock = $this->getGatewayMock(); |
|
| 855 | $gatewayMock->expects($this->once()) |
|
| 856 | ->method('countGroupsForType') |
|
| 857 | ->with( |
|
| 858 | $this->equalTo(23), |
|
| 859 | $this->equalTo(1) |
|
| 860 | ) |
|
| 861 | // Only 1 group assigned |
|
| 862 | ->will($this->returnValue(1)); |
|
| 863 | ||
| 864 | $mapperMock = $this->getMapperMock(); |
|
| 865 | ||
| 866 | $handler = $this->getHandler(); |
|
| 867 | $res = $handler->unlink(3, 23, 1); |
|
| 868 | } |
|
| 869 | ||
| 870 | /** |
|
| 871 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Type\Handler::getFieldDefinition |
|
| @@ 1467-1482 (lines=16) @@ | ||
| 1464 | /** |
|
| 1465 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Handler::setStatus |
|
| 1466 | */ |
|
| 1467 | public function testSetStatus() |
|
| 1468 | { |
|
| 1469 | $handler = $this->getContentHandler(); |
|
| 1470 | ||
| 1471 | $mapperMock = $this->getMapperMock(); |
|
| 1472 | $gatewayMock = $this->getGatewayMock(); |
|
| 1473 | ||
| 1474 | $gatewayMock->expects($this->once()) |
|
| 1475 | ->method('setStatus') |
|
| 1476 | ->with(23, 5, 2) |
|
| 1477 | ->will($this->returnValue(true)); |
|
| 1478 | ||
| 1479 | $this->assertTrue( |
|
| 1480 | $handler->setStatus(23, 2, 5) |
|
| 1481 | ); |
|
| 1482 | } |
|
| 1483 | ||
| 1484 | /** |
|
| 1485 | * Returns the handler to test. |
|