public function testExoticDateTime() { $config = new Config(); $config->setDateTimeFormat('W-Y'); $sqliteDb = $this->getSQLite($config); $dateTime = new DateTime(); $assertString = $dateTime->format('W-Y'); $sqliteDb->query("INSERT INTO datetimespecial VALUES (:DATE)")->bindDate('DATE', $dateTime)->execute(); $row = $sqliteDb->query("SELECT * FROM datetimespecial")->fetchRow(); $this->assertSame($assertString, $row['update']); }
/** * @param Config $config */ public function __construct(Config $config) { $this->actionQueue = new ActionQueue(); $this->dateTimeFormat = $config->getDateTimeFormat(); $username = $config->getUsername(); $password = $config->getPassword(); $dsn = $config->getDsn(); $options = $config->getPdoOptions(); $this->connection = new Connection($username, $password, $dsn, $options, $this->actionQueue); }
public function testProfiler() { $config = new Config(); $config->setDsn('sqlite::memory:'); $database = new Database($config); $profiler = new Profiler(); $database->addProfiler($profiler); $database->query("SELECT 1")->fetchAll(); $result = $profiler->getLogData(); $result = $result[0]; // PHP 5.3 compatible $this->assertSame(1, $result->getId()); $this->assertSame("SELECT 1", $result->getQueryString()); }