public function testGetRandomIds() { $limit = 3; $this->ormMock->expects($this->once())->method('selectFields')->with([$this->model->getIdField()])->will($this->returnSelf()); $this->ormMock->expects($this->once())->method('orderByDesc')->with('RAND()')->will($this->returnSelf()); $this->ormMock->expects($this->once())->method('limit')->with($limit)->will($this->returnSelf()); $this->ormMock->expects($this->once())->method('fetchAll')->will($this->returnValue([['id' => 11], ['id' => 13], ['id' => 12]])); $this->assertEquals([11, 13, 12], $this->model->getRandomIds($limit)); }