Ejemplo n.º 1
0
 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)));
 }
Ejemplo n.º 2
0
 protected function getFormattedItem($row)
 {
     return Reflectory::invokeObjectsMethodnameWith($this->folderNav, 'getFormattedItem', array($row, $this->uri));
 }
Ejemplo n.º 3
0
 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));
 }