protected function getFormattedItem($row) { return Reflectory::invokeObjectsMethodnameWith($this->folderNav, 'getFormattedItem', array($row, $this->uri)); }
public function testAreNomosMonkNinkaAgreed_notIfAnyOther() { $deciderAgent = new DeciderAgent(); $licId = 401; $otherLicId = 402; $licenseMatches = array('monk' => array($this->createLicenseMatchWithLicId($licId)), 'nomos' => array($this->createLicenseMatchWithLicId($licId), $this->createLicenseMatchWithLicId($otherLicId)), 'ninka' => array($this->createLicenseMatchWithLicId($licId))); $agree = Reflectory::invokeObjectsMethodnameWith($deciderAgent, 'areNomosMonkNinkaAgreed', array($licenseMatches)); assertThat($agree, equalTo(false)); }
public function testHandleCsv() { $dbManager = M::mock(DbManager::classname()); $licenseCsvImport = new LicenseCsvImport($dbManager); Reflectory::invokeObjectsMethodnameWith($licenseCsvImport, 'handleCsv', array(array('shortname', 'foo', 'text', 'fullname', 'notes'))); assertThat(Reflectory::getObjectsProperty($licenseCsvImport, 'headrow'), is(notNullValue())); $dbManager->shouldReceive('getSingleRow')->with('SELECT rf_shortname,rf_source,rf_pk,rf_risk FROM license_ref WHERE rf_md5=md5($1)', anything())->andReturn(false); $dbManager->shouldReceive('prepare'); $dbManager->shouldReceive('execute'); $dbManager->shouldReceive('freeResult'); $dbManager->shouldReceive('fetchArray')->andReturn(array('rf_pk' => 101, 'rf_risk' => 1)); Reflectory::setObjectsProperty($licenseCsvImport, 'nkMap', array('licA' => false)); Reflectory::invokeObjectsMethodnameWith($licenseCsvImport, 'handleCsv', array(array('licA', 'bar', 'txA', 'liceA', 'noteA'))); assertThat(Reflectory::getObjectsProperty($licenseCsvImport, 'nkMap'), is(array('licA' => 101))); }
public function testFullMapWithCandidates() { $licenseMap = new LicenseMap($this->dbManager, $this->groupId, LicenseMap::CONCLUSION, true); $map = \Fossology\Lib\Test\Reflectory::getObjectsProperty($licenseMap, 'map'); assertThat($map, hasItemInArray(array('rf_fk' => 1, 'parent_shortname' => 'One', 'rf_parent' => 1))); assertThat($map, hasItemInArray(array('rf_fk' => 2, 'parent_shortname' => 'One', 'rf_parent' => 1))); assertThat($map, hasItemInArray(array('rf_fk' => 3, 'parent_shortname' => 'Three', 'rf_parent' => 3))); }