eZ\Publish\Core\Repository\Tests\Service\Mock\ContentTest::testCreateContentWithRollback PHP Method

testCreateContentWithRollback() public method

Test for the createContent() method.
    public function testCreateContentWithRollback()
    {
        $fieldDefinitions = array(new FieldDefinition(array('id' => 'fieldDefinitionId', 'fieldTypeIdentifier' => 'fieldTypeIdentifier', 'isTranslatable' => false, 'identifier' => 'identifier', 'isRequired' => false, 'defaultValue' => 'defaultValue')));
        // Setup a simple case that will pass
        $contentCreateStruct = $this->assertForTestCreateContentNonRedundantFieldSet('eng-US', array(), array(), $fieldDefinitions, array(), false, false);
        $repositoryMock = $this->getRepositoryMock();
        $repositoryMock->expects($this->never())->method('commit');
        $repositoryMock->expects($this->once())->method('rollback');
        /** @var \PHPUnit_Framework_MockObject_MockObject $contentHandlerMock */
        $contentHandlerMock = $this->getPersistenceMock()->contentHandler();
        $contentHandlerMock->expects($this->once())->method('create')->with($this->anything())->will($this->throwException(new \Exception('Store failed')));
        // Execute
        $this->partlyMockedContentService->createContent($contentCreateStruct, array());
    }
ContentTest