eZ\Publish\Core\Persistence\Legacy\Tests\Content\Type\ContentUpdater\Action\AddFieldTest::testInsertExistingField PHP Method

testInsertExistingField() public method

    public function testInsertExistingField()
    {
        $versionInfo = new Content\VersionInfo();
        $content = new Content();
        $content->versionInfo = $versionInfo;
        $value = new Content\FieldValue();
        $field = new Field();
        $field->id = 32;
        $field->value = $value;
        $this->getFieldValueConverterMock()->expects($this->once())->method('toStorageValue')->with($value, $this->isInstanceOf('eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\StorageFieldValue'));
        $this->getContentGatewayMock()->expects($this->once())->method('insertExistingField')->with($content, $field, $this->isInstanceOf('eZ\\Publish\\Core\\Persistence\\Legacy\\Content\\StorageFieldValue'));
        $this->getContentStorageHandlerMock()->expects($this->once())->method('storeFieldData')->with($versionInfo, $field)->will($this->returnValue(false));
        $this->getContentGatewayMock()->expects($this->never())->method('updateField');
        $action = $this->getMockedAction();
        $refAction = new ReflectionObject($action);
        $refMethod = $refAction->getMethod('insertField');
        $refMethod->setAccessible(true);
        $fieldId = $refMethod->invoke($action, $content, $field);
        $this->assertEquals(32, $fieldId);
        $this->assertEquals(32, $field->id);
    }