/** * Website loeschen * * Der Test holt sich erst alle vorhanden Websites, der erste Eintrag * wird genutzt um die Pruefung von delete durchzufuehren * * @test * @group integration */ public function success() { // ARRANGE $websiteId = 'SITE-1964e89c-22af-46cd-a651-fc42dc78fe50-SITE'; $runId = 'CMSRUNID-00000000-0000-0000-0000-000000000001-CMSRUNID'; $websiteService = new \Cms\Service\Website('Website'); $templateService = new \Cms\Service\Template('Template'); $snippetService = new \Cms\Service\TemplateSnippet('TemplateSnippet'); $pageService = new \Cms\Service\Page('Page'); $packageService = new \Cms\Service\Package('Package'); $moduleService = new \Cms\Service\Modul('Modul'); // check if items exists $this->assertTrue($websiteService->existsWebsiteAlready($websiteId)); $this->assertNotEmpty($templateService->getAll($websiteId)); $this->assertNotEmpty($snippetService->getAll($websiteId)); $this->assertNotEmpty($pageService->getIdsByWebsiteId($websiteId)); $this->assertNotEmpty($packageService->getAll($websiteId)); $this->assertNotEmpty($moduleService->getAll($websiteId)); $params = array('id' => $websiteId, 'runId' => $runId); $paramsAsJson = json_encode($params); // ACT $this->dispatch('website/delete/params/' . $paramsAsJson); // ASSERT $this->getValidatedSuccessResponse(); // check if website is deleted $websiteExists = $websiteService->existsWebsiteAlready($websiteId); $this->assertFalse($websiteExists); // verify that all templates of the website has been deleted $templates = $templateService->getAll($websiteId); $this->assertInternalType('array', $templates); $this->assertCount(0, $templates); // verify that all templates snippets of the website has been deleted $snippets = $snippetService->getAll($websiteId); $this->assertInternalType('array', $snippets); $this->assertCount(0, $snippets); // verify that all pages of the website has been deleted $pageIds = $pageService->getIdsByWebsiteId($websiteId); $this->assertInternalType('array', $pageIds); $this->assertCount(0, $pageIds); // verify that all packages of the website has been deleted $allPackagesAfterDeleteWebsite = $packageService->getAll($websiteId); $this->assertCount(0, $allPackagesAfterDeleteWebsite, 'Failed asserting that deleted website has no packages'); // verify that all modules of the website has been deleted $allModulesAfterDeleteWebsite = $moduleService->getAll($websiteId); $this->assertCount(0, $allModulesAfterDeleteWebsite, 'Failed asserting that deleted website has no modules'); }