1<?php
2//
3// $Id: GetQueryStringTest.php 322098 2012-01-11 21:20:03Z danielc $
4//
5
6require_once dirname(__FILE__) . '/TestCase.php';
7
8/**
9* This class just checks if the query is returned, not if
10* the query was properly rendered. This should be subject to
11* some other tests!
12*
13* @package tests
14*/
15class tests_GetQueryStringTest extends tests_TestCase
16{
17    function _setup()
18    {
19        $this->question = new tests_Common(TABLE_QUESTION);
20        $this->question->setOption('raw', true);
21    }
22
23    function test_selectAll()
24    {
25        $this->_setup();
26        $this->assertStringEquals(
27                            'SELECT '.TABLE_QUESTION.'.id AS id,'.TABLE_QUESTION.'.'.TABLE_QUESTION.' AS '.TABLE_QUESTION.' FROM '.TABLE_QUESTION
28                            ,$this->question->getQueryString());
29    }
30
31    function test_selectWithWhere()
32    {
33        $this->_setup();
34        $this->question->setWhere('id=1');
35        $this->assertStringEquals(
36                            'SELECT '.TABLE_QUESTION.'.id AS id,'.TABLE_QUESTION.'.'.TABLE_QUESTION.' AS '.TABLE_QUESTION.' FROM '.TABLE_QUESTION.
37                            ' WHERE id=1'
38                            ,$this->question->getQueryString());
39    }
40}
41
42?>
43