a tiny mvc framework for php using php-activerecord
at v1 46 lines 1.1 kB view raw
1<?php 2include 'helpers/config.php'; 3require_once __DIR__ . '/../lib/adapters/SqliteAdapter.php'; 4 5class SqliteAdapterTest extends AdapterTest 6{ 7 public function set_up($connection_name=null) 8 { 9 parent::set_up('sqlite'); 10 } 11 12 public function tearDown() 13 { 14 parent::tearDown(); 15 16 @unlink($this->db); 17 @unlink(self::InvalidDb); 18 } 19 20 public function testConnectToInvalidDatabaseShouldNotCreateDbFile() 21 { 22 try 23 { 24 ActiveRecord\Connection::instance("sqlite://" . self::InvalidDb); 25 $this->assertFalse(true); 26 } 27 catch (ActiveRecord\DatabaseException $e) 28 { 29 $this->assertFalse(file_exists(__DIR__ . "/" . self::InvalidDb)); 30 } 31 } 32 33 public function test_limit_with_null_offset_does_not_contain_offset() 34 { 35 $ret = array(); 36 $sql = 'SELECT * FROM authors ORDER BY name ASC'; 37 $this->conn->query_and_fetch($this->conn->limit($sql,null,1),function($row) use (&$ret) { $ret[] = $row; }); 38 39 $this->assert_true(strpos($this->conn->last_query, 'LIMIT 1') !== false); 40 } 41 42 // not supported 43 public function testCompositeKey() {} 44 public function testConnectWithPort() {} 45} 46?>