| @@ 891-918 (lines=28) @@ | ||
| 888 | /** |
|
| 889 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\Handler::loadReverseRelations |
|
| 890 | */ |
|
| 891 | public function testLoadReverseRelations() |
|
| 892 | { |
|
| 893 | $handler = $this->getContentHandler(); |
|
| 894 | ||
| 895 | $gatewayMock = $this->getGatewayMock(); |
|
| 896 | $mapperMock = $this->getMapperMock(); |
|
| 897 | ||
| 898 | $gatewayMock->expects($this->once()) |
|
| 899 | ->method('loadReverseRelations') |
|
| 900 | ->with( |
|
| 901 | $this->equalTo(23), |
|
| 902 | $this->equalTo(null) |
|
| 903 | )->will( |
|
| 904 | $this->returnValue([42]) |
|
| 905 | ); |
|
| 906 | ||
| 907 | $mapperMock->expects($this->once()) |
|
| 908 | ->method('extractRelationsFromRows') |
|
| 909 | ->with($this->equalTo([42])) |
|
| 910 | ->will($this->returnValue($this->getRelationFixture())); |
|
| 911 | ||
| 912 | $result = $handler->loadReverseRelations(23); |
|
| 913 | ||
| 914 | $this->assertEquals( |
|
| 915 | $result, |
|
| 916 | $this->getRelationFixture() |
|
| 917 | ); |
|
| 918 | } |
|
| 919 | ||
| 920 | public function testAddRelation() |
|
| 921 | { |
|
| @@ 384-406 (lines=23) @@ | ||
| 381 | /** |
|
| 382 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\ObjectState\Handler::loadByIdentifier |
|
| 383 | */ |
|
| 384 | public function testLoadByIdentifier() |
|
| 385 | { |
|
| 386 | $handler = $this->getObjectStateHandler(); |
|
| 387 | $mapperMock = $this->getMapperMock(); |
|
| 388 | $gatewayMock = $this->getGatewayMock(); |
|
| 389 | ||
| 390 | $gatewayMock->expects($this->once()) |
|
| 391 | ->method('loadObjectStateDataByIdentifier') |
|
| 392 | ->with($this->equalTo('not_locked'), $this->equalTo(2)) |
|
| 393 | ->will($this->returnValue([[]])); |
|
| 394 | ||
| 395 | $mapperMock->expects($this->once()) |
|
| 396 | ->method('createObjectStateFromData') |
|
| 397 | ->with($this->equalTo([[]])) |
|
| 398 | ->will($this->returnValue($this->getObjectStateFixture())); |
|
| 399 | ||
| 400 | $result = $handler->loadByIdentifier('not_locked', 2); |
|
| 401 | ||
| 402 | $this->assertInstanceOf( |
|
| 403 | ObjectState::class, |
|
| 404 | $result |
|
| 405 | ); |
|
| 406 | } |
|
| 407 | ||
| 408 | /** |
|
| 409 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\ObjectState\Handler::loadByIdentifier |
|
| @@ 597-619 (lines=23) @@ | ||
| 594 | /** |
|
| 595 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\ObjectState\Handler::getContentState |
|
| 596 | */ |
|
| 597 | public function testGetContentState() |
|
| 598 | { |
|
| 599 | $handler = $this->getObjectStateHandler(); |
|
| 600 | $mapperMock = $this->getMapperMock(); |
|
| 601 | $gatewayMock = $this->getGatewayMock(); |
|
| 602 | ||
| 603 | $gatewayMock->expects($this->once()) |
|
| 604 | ->method('loadObjectStateDataForContent') |
|
| 605 | ->with($this->equalTo(42), $this->equalTo(2)) |
|
| 606 | ->will($this->returnValue([[]])); |
|
| 607 | ||
| 608 | $mapperMock->expects($this->once()) |
|
| 609 | ->method('createObjectStateFromData') |
|
| 610 | ->with($this->equalTo([[]])) |
|
| 611 | ->will($this->returnValue($this->getObjectStateFixture())); |
|
| 612 | ||
| 613 | $result = $handler->getContentState(42, 2); |
|
| 614 | ||
| 615 | $this->assertInstanceOf( |
|
| 616 | ObjectState::class, |
|
| 617 | $result |
|
| 618 | ); |
|
| 619 | } |
|
| 620 | ||
| 621 | /** |
|
| 622 | * @covers \eZ\Publish\Core\Persistence\Legacy\Content\ObjectState\Handler::getContentCount |
|