/**
  * Tests the _getListCount method.
  *
  * @since   12.3
  *
  * @return  void
  *
  * @testdox _getListCount() passes query object to database
  */
 public function testGetListCountPassesQueryObjectToDatabase()
 {
     $method = new ReflectionMethod('TestModelLead', '_getListCount');
     $method->setAccessible(true);
     $queryMock = $this->getMock('JDatabaseQuery', array('select', 'clear'));
     $queryMock->method('clear')->will($this->returnSelf());
     TestReflection::setValue($queryMock, 'type', 'select');
     $dbMock = $this->getMockDatabase();
     $dbMock->expects($this->once())->method('setQuery')->with($this->equalTo($queryMock))->willReturnSelf();
     $dbMock->expects($this->once())->method('loadResult')->willReturn(1);
     $this->fixture->setDbo($dbMock);
     $this->assertEquals(1, $method->invokeArgs($this->fixture, array($queryMock)));
 }
Ejemplo n.º 2
0
 /**
  * Tests the setDbo method.
  *
  * @since   12.3
  *
  * @return  void
  */
 public function testSetDbo()
 {
     $this->fixture->setDbo(new stdClass());
     $this->assertTrue($this->fixture->getDbo() instanceof stdClass);
 }