Use of old PDO singleton.

Also fixup test suite to check behaviour of set_mime (only setter)
This commit is contained in:
Benoît Burnichon
2015-07-10 11:43:51 +02:00
parent dd73d6dae2
commit c9cd428acc
2 changed files with 14 additions and 1 deletions

View File

@@ -246,7 +246,7 @@ class record_adapter implements RecordInterface, cache_cacheableInterface
throw new \Exception(sprintf('Unrecognized mime type %s', $mime)); throw new \Exception(sprintf('Unrecognized mime type %s', $mime));
} }
$connection = connection::getPDOConnection($this->app, $this->get_sbas_id()); $connection = $this->databox->get_connection();
$sql = 'UPDATE record SET mime = :mime WHERE record_id = :record_id'; $sql = 'UPDATE record SET mime = :mime WHERE record_id = :record_id';
$stmt = $connection->prepare($sql); $stmt = $connection->prepare($sql);

View File

@@ -207,6 +207,19 @@ class record_adapterTest extends \PhraseanetAuthenticatedTestCase
$this->assertRegExp('/image\/\w+/', self::$DI['record_1']->get_mime()); $this->assertRegExp('/image\/\w+/', self::$DI['record_1']->get_mime());
} }
public function testSetMimeType()
{
/** @var record_adapter $record_1 */
$record_1 = self::$DI['record_1'];
$oldMime = $record_1->get_mime();
$record_1->set_mime('foo/bar');
$this->assertEquals('foo/bar', $record_1->get_mime());
$record_1->set_mime($oldMime);
$this->assertEquals($oldMime, $record_1->get_mime());
}
public function testGet_status() public function testGet_status()
{ {
$this->assertRegExp('/[01]{32}/', self::$DI['record_1']->get_status()); $this->assertRegExp('/[01]{32}/', self::$DI['record_1']->get_status());