예제 #1
0
파일: TableTest.php 프로젝트: rjsmelo/tiki
 function testFetchMap()
 {
     $mock = $this->getMock('TikiDb');
     $query = 'SELECT `user`, `email` 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', 'email' => '*****@*****.**'), array('user' => 'world', 'email' => '*****@*****.**'))));
     $table = new TikiDb_Table($mock, 'users_users');
     $expect = array('hello' => '*****@*****.**', 'world' => '*****@*****.**');
     $this->assertEquals($expect, $table->fetchMap('user', 'email', array('userId' => $table->greaterThan(42)), -1, -1, array('user' => 'DESC')));
 }