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

testUpdateContentTransactionRollback() public method

Test for the updateContent() method.
    public function testUpdateContentTransactionRollback()
    {
        $existingFields = array(new Field(array('id' => '100', 'fieldDefIdentifier' => 'identifier', 'value' => 'initialValue', 'languageCode' => 'eng-GB')));
        $fieldDefinitions = array(new FieldDefinition(array('id' => 'fieldDefinitionId', 'fieldTypeIdentifier' => 'fieldTypeIdentifier', 'isTranslatable' => false, 'identifier' => 'identifier', 'isRequired' => false, 'defaultValue' => 'defaultValue')));
        // Setup a simple case that will pass
        list($versionInfo, $contentUpdateStruct) = $this->assertForTestUpdateContentNonRedundantFieldSet('eng-US', array(), array(), $existingFields, $fieldDefinitions, 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('updateContent')->with($this->anything(), $this->anything(), $this->anything())->will($this->throwException(new \Exception('Store failed')));
        // Execute
        $this->partlyMockedContentService->updateContent($versionInfo, $contentUpdateStruct);
    }
ContentTest