db = Query('test_sqlite'); } // -------------------------------------------------------------------------- public function testQueryFunctionAlias() { $db = Query('test_sqlite'); $this->assertTrue($this->db === $db, "Alias passed into query function gives the original object back"); } // -------------------------------------------------------------------------- public function testQueryExplain() { $query = $this->db->select('id, key as k, val') ->explain() ->where('id >', 1) ->where('id <', 900) ->get('create_test', 2, 1); $res = $query->fetchAll(PDO::FETCH_ASSOC); $expected_possibilities = array(); $expected_possibilities[] = array( array( 'order' => '0', 'from' => '0', 'detail' => 'TABLE create_test USING PRIMARY KEY', ) ); $expected_possibilities[] = array ( array ( 'selectid' => '0', 'order' => '0', 'from' => '0', 'detail' => 'SEARCH TABLE create_test USING INTEGER PRIMARY KEY (rowid>? AND rowid '0', 'order' => '0', 'from' => '0', 'detail' => 'SEARCH TABLE create_test USING INTEGER PRIMARY KEY (rowid>? AND rowid '0', 'order' => '0', 'from' => '0', 'detail' => 'SEARCH TABLE create_test USING INTEGER PRIMARY KEY (rowid>? AND rowidassertTrue(TRUE); $passed = TRUE; } } // Well, apparently not an expected possibility if ( ! $passed) { var_export($res); $this->assertTrue(FALSE); } } }