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

testInsertUrl() public method

public testInsertUrl ( )
    public function testInsertUrl()
    {
        $gateway = $this->getStorageGateway();
        $url = 'one/two/three';
        $time = time();
        $id = $gateway->insertUrl($url);
        $query = $this->getDatabaseHandler()->createSelectQuery();
        $query->select('*')->from('ezurl')->where($query->expr->eq($this->handler->quoteColumn('id'), $query->bindValue($id)));
        $statement = $query->prepare();
        $statement->execute();
        $result = $statement->fetchAll(\PDO::FETCH_ASSOC);
        $expected = array(array('id' => $id, 'is_valid' => '1', 'last_checked' => '0', 'original_url_md5' => md5($url), 'url' => $url));
        $this->assertGreaterThanOrEqual($time, $result[0]['created']);
        $this->assertGreaterThanOrEqual($time, $result[0]['modified']);
        unset($result[0]['created']);
        unset($result[0]['modified']);
        $this->assertEquals($expected, $result);
    }