_soapURL = $GLOBALS['sugar_config']['site_url'].'/soap.php'; parent::setUp(); SugarTestHelper::setUp('beanFiles'); SugarTestHelper::setUp('beanList'); $this->user = SugarTestHelper::setUp('current_user', array(true, true)); // Create an opportunity for the report $opportunity = SugarTestOpportunityUtilities::createOpportunity(); // Create and save summary with details report on opportunities, filtered by id of the above created opportunity $this->_report = new Report('{"display_columns":[{"name":"name","label":"Opportunity Name","table_key":"self"},{"name":"sales_stage","label":"Sales Stage","table_key":"self"}],"module":"Opportunities","group_defs":[{"name":"opportunity_type","label":"Type","table_key":"self","type":"enum","force_label":"Type"}],"summary_columns":[{"name":"opportunity_type","label":"Type","table_key":"self"}],"report_name":"Opp by type","chart_type":"none","do_round":1,"chart_description":"","numerical_chart_column":"","numerical_chart_column_type":"","assigned_user_id":"1","report_type":"summary","full_table_list":{"self":{"value":"Opportunities","module":"Opportunities","label":"Opportunities"}},"filters_def":{"Filter_1":{"0":{"name":"id","table_key":"self","qualifier_name":"is","input_name0":"' . $opportunity->id . '","input_name1":"' . $opportunity->name . '","column_name":"self:id","id":"rowid0"},"operator":"AND"}}}'); $_REQUEST['assigned_user_id'] = $GLOBALS['current_user']->id; $this->_report->save("testSummaryReportWithDetails"); } public function tearDown() { $GLOBALS['db']->query("DELETE FROM saved_reports WHERE id = '{$this->_report->saved_report->id}'"); SugarTestOpportunityUtilities::removeAllCreatedOpportunities(); SugarTestHelper::tearDown(); } // Test if the returned data is proper public function testSummaryReportWithDetails() { $this->_login(); // Setup call $client = array( 'session' => $this->_sessionId, 'module_name' => 'Reports', 'id' => $this->_report->saved_report->id, 'select_fields' => array(), ); // Call get_entry on saved report $result = $this->_soapClient->call('get_entry', $client); // Check if the soap call returned the details rows $this->assertNotEmpty($result['entry_list'], "Report shouldn't be empty."); $this->assertNotEmpty($result['entry_list'][0]['details'], "Summary Report Details shouldn't be empty."); // Check if the returned headers for the details have the correct type $this->assertEquals($result['field_list'][2]['type'], 'details', "Type of detail columns headers should be 'details'."); } }