/** * Tests for handleRealRowCountRequestAction() * * @return void * @test */ public function testHandleRealRowCountRequestAction() { $_REQUEST['table'] = 'table'; $ctrl = new DatabaseStructureController(null, null, null, null, null, null, null); $ctrl->handleRealRowCountRequestAction(); $json = $this->_response->getJSONResult(); $this->assertEquals(6, $json['real_row_count']); // Fall into another branch $_REQUEST['real_row_count_all'] = 'abc'; $GLOBALS['tables'] = array(array('TABLE_NAME' => 'table')); $ctrl->handleRealRowCountRequestAction(); $json = $this->_response->getJSONResult(); $expected_result = array(array('table' => 'table', 'row_count' => 6)); $this->assertEquals(json_encode($expected_result), $json['real_row_count_all']); }
/** * Tests for handleRealRowCountRequestAction() * * @return void * @test */ public function testHandleRealRowCountRequestAction() { $_REQUEST['table'] = 'table'; $ctrl = new DatabaseStructureController($GLOBALS['db'], null); // Showing statistics $class = new ReflectionClass('PMA\\libraries\\controllers\\database\\DatabaseStructureController'); $property = $class->getProperty('_tables'); $property->setAccessible(true); $ctrl->handleRealRowCountRequestAction(); $json = $this->_response->getJSONResult(); $this->assertEquals(6, $json['real_row_count']); // Fall into another branch $_REQUEST['real_row_count_all'] = 'abc'; $property->setValue($ctrl, array(array('TABLE_NAME' => 'table'))); $ctrl->handleRealRowCountRequestAction(); $json = $this->_response->getJSONResult(); $expected_result = array(array('table' => 'table', 'row_count' => 6)); $this->assertEquals(json_encode($expected_result), $json['real_row_count_all']); }