public function testStoreFieldDataWithNewUrl()
{
$versionInfo = new VersionInfo(array('versionNo' => 24));
$fieldValue = new FieldValue(array('externalData' => 'http://ez.no'));
$field = new Field(array('id' => 42, 'value' => $fieldValue));
$gateway = $this->getGatewayMock();
$gateway->expects($this->once())->method('getUrlIdMap')->with(array('http://ez.no'))->will($this->returnValue(array()));
$gateway->expects($this->once())->method('insertUrl')->with('http://ez.no')->will($this->returnValue(12));
$gateway->expects($this->once())->method('linkUrl')->with(12, 42, 24);
$storage = $this->getPartlyMockedStorage(array('getGateway'));
$storage->expects($this->once())->method('getGateway')->with($this->getContext())->will($this->returnValue($gateway));
$result = $storage->storeFieldData($versionInfo, $field, $this->getContext());
$this->assertTrue($result);
$this->assertEquals(12, $field->value->data['urlId']);
}