예제 #1
0
파일: TableTest.php 프로젝트: rjsmelo/tiki
 function testAliasField()
 {
     $mock = $this->getMock('TikiDb');
     $query = 'SELECT `user`, `email` AS `address` FROM `users_users` WHERE 1=1 AND `userId` > ? ORDER BY `user` DESC';
     $mock->expects($this->once())->method('fetchAll')->with($this->equalTo($query), $this->equalTo(array(42)), $this->equalTo(-1), $this->equalTo(-1))->will($this->returnValue(array(array('user' => 'hello', 'address' => '*****@*****.**'), array('user' => 'world', 'address' => '*****@*****.**'))));
     $table = new TikiDb_Table($mock, 'users_users');
     $expect = array(array('user' => 'hello', 'address' => '*****@*****.**'), array('user' => 'world', 'address' => '*****@*****.**'));
     $this->assertEquals($expect, $table->fetchAll(array('user', 'address' => 'email'), array('userId' => $table->greaterThan(42)), -1, -1, array('user' => 'DESC')));
 }