eZ\Publish\Core\FieldType\Tests\Url\Gateway\LegacyStorageTest::testUnlinkUrl PHP Method

testUnlinkUrl() public method

public testUnlinkUrl ( )
    public function testUnlinkUrl()
    {
        $this->insertDatabaseFixture(__DIR__ . '/_fixtures/urls.php');
        $gateway = $this->getStorageGateway();
        $fieldId = 42;
        $versionNo = 5;
        $gateway->unlinkUrl($fieldId, $versionNo);
        $query = $this->getDatabaseHandler()->createSelectQuery();
        $query->select('*')->from('ezurl_object_link');
        $statement = $query->prepare();
        $statement->execute();
        $result = $statement->fetchAll(\PDO::FETCH_ASSOC);
        $expected = array(array('contentobject_attribute_id' => 43, 'contentobject_attribute_version' => 6, 'url_id' => 24));
        $this->assertEquals($expected, $result);
        // Check that orphaned URLs are correctly removed
        $query = $this->getDatabaseHandler()->createSelectQuery();
        $query->select('*')->from('ezurl');
        $statement = $query->prepare();
        $statement->execute();
        $result = $statement->fetchAll(\PDO::FETCH_ASSOC);
        $expected = array(array('created' => '1343140541', 'id' => '24', 'is_valid' => '1', 'last_checked' => '0', 'modified' => '1343140541', 'original_url_md5' => 'c86bcb109d8e70f9db65c803baafd550', 'url' => '/content/view/tagcloud/2'));
        $this->assertEquals($expected, $result);
    }