/**
  * Delete the parent NGI and ensure all sites, servcies, endponts and downtimes  
  * are deleted leaving only the orphan dowmtime. 
  */
 public function testNgiService_removeNgi()
 {
     print __METHOD__ . "\n";
     include __DIR__ . '/resources/sampleFixtureData4.php';
     $adminUser = TestUtil::createSampleUser('some', 'admin', '/some/admin');
     $adminUser->setAdmin(TRUE);
     $this->em->persist($adminUser);
     $ngiService = new org\gocdb\services\NGI();
     $ngiService->setEntityManager($this->em);
     $ngiService->deleteNgi($ngi, $adminUser, FALSE);
     // use DB connection to check data has been deleted
     $con = $this->getConnection();
     $result = $con->createQueryTable('results_table', "SELECT * FROM EndpointLocations");
     $this->assertTrue($result->getRowCount() == 0);
     $result = $con->createQueryTable('results_table', "SELECT * FROM Downtimes");
     $this->assertTrue($result->getRowCount() == 1);
     // orphanDT
     $result = $con->createQueryTable('results_table', "SELECT * FROM Sites");
     $this->assertTrue($result->getRowCount() == 0);
     // site2
 }
Beispiel #2
0
 /**
  * Test the NGI service deleteNGI() method which recursively deletes child 
  * sites and services, roles etc.  
  */
 public function testNgiService_deleteNgi()
 {
     print __METHOD__ . "\n";
     include __DIR__ . '/resources/sampleFixtureData1.php';
     // create an admin user (required to call the NGI service)
     $adminUser = TestUtil::createSampleUser('some', 'admin', '/some/admin');
     $adminUser->setAdmin(TRUE);
     $this->em->persist($adminUser);
     // Now delete the ngi using the NGI service.
     $ngiService = new org\gocdb\services\NGI();
     $ngiService->setEntityManager($this->em);
     $ngiService->deleteNgi($ngi, $adminUser, FALSE);
     // since we deleted the NGI, we expect an empty DB !
     $result = $testConn->createQueryTable('results_table', "SELECT * FROM Roles");
     $this->assertTrue($result->getRowCount() == 0);
     $result = $testConn->createQueryTable('results_table', "SELECT * FROM NGIs");
     $this->assertTrue($result->getRowCount() == 0);
     $result = $testConn->createQueryTable('results_table', "SELECT * FROM Sites");
     $this->assertTrue($result->getRowCount() == 0);
     $result = $testConn->createQueryTable('results_table', "SELECT * FROM Services");
     $this->assertTrue($result->getRowCount() == 0);
     $result = $testConn->createQueryTable('results_table', "SELECT * FROM Downtimes");
     $this->assertTrue($result->getRowCount() == 0);
     $result = $testConn->createQueryTable('results_table', "SELECT * FROM EndpointLocations");
     $this->assertTrue($result->getRowCount() == 0);
     $result = $testConn->createQueryTable('results_table', "SELECT * FROM CertificationStatusLogs");
     $this->assertTrue($result->getRowCount() == 0);
 }
Beispiel #3
0
 public function testNgiService_removeNgi()
 {
     print __METHOD__ . "\n";
     include __DIR__ . '/resources/sampleFixtureData1.php';
     $adminUser = TestUtil::createSampleUser('some', 'admin', '/some/admin');
     $adminUser->setAdmin(TRUE);
     $this->em->persist($adminUser);
     $ngiService = new org\gocdb\services\NGI();
     $ngiService->setEntityManager($this->em);
     $ngiService->deleteNgi($ngi, $adminUser, FALSE);
 }