Esempio n. 1
0
 protected function setUp()
 {
     MockManager::activateWebsiteSettingsMock(true);
     parent::setUp();
     $config = Registry::getConfig();
     $this->testFilesDirectory = $config->test->files->directory;
 }
Esempio n. 2
0
 /**
  * @param  string $uri
  * @return string
  */
 protected function changeUserRenewPasswordUri($uri)
 {
     $formerUri = Registry::getConfig()->user->mail->renew->password->uri;
     $this->mergeIntoConfig(array('user' => array('mail' => array('renew' => array('password' => array('uri' => $uri))))));
     $this->assertSame($uri, Registry::getConfig()->user->mail->renew->password->uri);
     return $formerUri;
 }
Esempio n. 3
0
 /**
  * @test
  * @group integration 
  */
 public function exportShouldDeliverExportAsExpected()
 {
     $config = Registry::getConfig();
     $exportName = 'test_export_cdn_delivery';
     $expectedExportFileName = $exportName . '.' . self::EXPORT_FILE_EXTENSION;
     $exportBaseDirectory = $config->export->directory;
     $exportZipFile = $exportBaseDirectory . DIRECTORY_SEPARATOR . md5($exportName) . DIRECTORY_SEPARATOR . md5($exportName) . '.' . self::EXPORT_FILE_EXTENSION;
     $this->copyExpectedExport($exportZipFile);
     $this->assertFileExists($exportZipFile);
     $expectedContent = file_get_contents($exportZipFile);
     $requestUri = sprintf('/cdn/export/params/{"name":"%s"}', $exportName);
     $this->dispatch($requestUri);
     if (file_exists($exportZipFile)) {
         $this->fail('Export file "' . $exportZipFile . '" exists after request!');
     }
     $response = $this->getResponse();
     $this->assertSame(200, $response->getHttpResponseCode());
     $this->assertEquals(1, $response->getTestCallbackCallCount());
     $reponseHeaders = $response->getHeaders();
     $expectedHeaders = array('Content-Type' => 'application/octet-stream', 'Content-Disposition' => 'attachment; filename="' . $expectedExportFileName . '"', 'Last-Modified' => 'Wed, 2 Mar 2011 10:51:20 GMT', 'Content-Length' => '300');
     $actualHeadersLeaned = array();
     foreach ($reponseHeaders as $reponseHeader) {
         $actualHeadersLeaned[$reponseHeader['name']] = $reponseHeader['value'];
     }
     foreach ($expectedHeaders as $expectedHeaderName => $expectedHeaderValue) {
         $this->assertArrayHasKey($expectedHeaderName, $actualHeadersLeaned);
         if ($expectedHeaderName !== 'Last-Modified') {
             $this->assertSame($expectedHeaderValue, $actualHeadersLeaned[$expectedHeaderName]);
         }
     }
     $callbackOutput = $response->getTestCallbackOutput();
     $this->assertEquals($expectedContent, $callbackOutput[0]);
 }
Esempio n. 4
0
 public function send()
 {
     // Config
     $config = Registry::getConfig();
     if (!$config->stats->graphite->enabled) {
         return;
     }
     $graphite_cfg = $config->stats->graphite->toArray();
     $graphiteStats = new GraphiteStats($graphite_cfg, Registry::getBaseUrl());
     $actionLog = $this->actionLogBusiness;
     $allWebsites = $this->websiteBusiness->getAll();
     // add some non ActionLog related metrics (gauges)
     $graphiteStats->addMetric('WEBSITE_COUNT', count($allWebsites));
     // website specific data
     foreach ($allWebsites as $website) {
         $log = $actionLog->getLog($website->getId(), null, null);
         foreach ($log as $logEntry) {
             $graphiteStats->addMetricByActionLogEntry($logEntry);
         }
     }
     // non-website specific data
     $globalLog = $actionLog->getLog('unknown-websiteid', null, null);
     foreach ($globalLog as $logEntry) {
         $graphiteStats->addMetricByActionLogEntry($logEntry);
     }
     $result = $graphiteStats->sendAll();
     // reflect result in data of "response"
     if (!$result) {
         throw new \Exception('Failed to send graphiteStats');
     }
 }
Esempio n. 5
0
 public function provider_test_getById_success()
 {
     $websiteId = 'SITE-controll-er0p-age0-getb-yid000000001-SITE';
     $pageId01 = 'PAGE-controll-er0p-age0-getb-yid010000001-PAGE';
     $pageId02 = 'PAGE-controll-er0p-age0-getb-yid010000002-PAGE';
     return array(array($websiteId, $pageId01, array('websiteId' => $websiteId, 'id' => $pageId01, 'templateId' => 'TPL-controll-er0p-age0-getb-yid010000001-TPL', 'name' => 'This ist the page name', 'description' => 'This is the page description', 'date' => 1314355284, 'inNavigation' => true, 'navigationTitle' => 'This is the page navigation title', 'content' => array(), 'pageType' => 'the_page_type_id', 'pageAttributes' => (object) array('foo' => 'bar', 'myArray' => array(), 'myObject' => (object) array()), 'mediaId' => 'MDB-controll-er0p-age0-getb-yid010000001-MDB', 'screenshot' => sprintf('%s%s/%s/%s', Registry::getConfig()->server->url, Registry::getConfig()->screens->url, Registry::getConfig()->request->parameter, urlencode(sprintf('{"websiteid":"%s","type":"page","id":"%s"}', $websiteId, $pageId01))))), array($websiteId, $pageId02, array('websiteId' => $websiteId, 'id' => $pageId02, 'templateId' => 'TPL-controll-er0p-age0-getb-yid010000001-TPL', 'name' => '', 'description' => '', 'date' => 0, 'inNavigation' => false, 'navigationTitle' => '', 'content' => null, 'pageType' => null, 'pageAttributes' => (object) array(), 'mediaId' => '', 'screenshot' => sprintf('%s%s/%s/%s', Registry::getConfig()->server->url, Registry::getConfig()->screens->url, Registry::getConfig()->request->parameter, urlencode(sprintf('{"websiteid":"%s","type":"page","id":"%s"}', $websiteId, $pageId02))))));
 }
Esempio n. 6
0
 public function __construct()
 {
     $config = Registry::getConfig()->publisher->toArray();
     $this->checkRequiredOptions($config);
     $this->config = $config;
     $this->setOptions();
 }
Esempio n. 7
0
 /**
  * Prueft anhand der Config, ob der Test ueberhaupt durchgefuehrt werden kann
  *
  * @return boolean
  */
 public function testIsActiv()
 {
     if (Registry::getConfig()->screens->activ == 'yes' || Registry::getConfig()->screens->activ == '1') {
         return true;
     }
     return false;
 }
Esempio n. 8
0
 /**
  * @test
  * @group integration
  */
 public function success()
 {
     Registry::getConfig()->webhost = 'http://sbcms-test-run';
     Registry::getConfig()->feedback->mail->adress = '*****@*****.**';
     $params = array('subject' => 'test feedback', 'body' => 'feedback test content from unittests', 'email' => '*****@*****.**', 'errors' => array(array('text' => urlencode('Scriptfehler:\\nUncaught Error: chrome.tabs is not supported in content scripts. See the content scripts documentation for more details.\\n\\n----\\n\\nZeile 282 in chrome/RendererExtensionBindings'), 'date' => urlencode('2011-08-12T09:40:22')), array('text' => urlencode('Scriptfehler:\\nUncaught Error: chrome.tabs is not supported in content scripts. See the content scripts documentation for more details.\\n\\n----\\n\\nZeile 282 in chrome/RendererExtensionBindings'), 'date' => urlencode('2011-08-12T09:40:23'))), 'userAgent' => urlencode('Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.112 Safari/535.1'), 'platform' => 'Win32');
     $paramsAsJson = json_encode($params);
     $this->dispatch('feedback/send/params/' . $paramsAsJson);
     $response = $this->getResponseBody();
     $this->assertNotNull($response);
     $this->assertInternalType('string', $response);
     $responseObject = json_decode($response);
     // Response allgemein pruefen
     $this->assertResponseBodySuccess($responseObject);
     // Erstelltes Feedback einlesen
     $filename = null;
     $handleDir = opendir($this->testFeedbackOutputDir);
     while (false !== ($nextFilename = readdir($handleDir))) {
         if ($nextFilename != '' && $nextFilename != '.' && $nextFilename != '..' && $nextFilename != '.gitignore') {
             $filename = $nextFilename;
             break;
         }
     }
     closedir($handleDir);
     $this->assertNotNull($filename, sprintf('Keine Feedbackdatei im Ordner "%s" vorhanden!', $this->testFeedbackOutputDir));
     $feedbackOutputFile = $this->testFeedbackOutputDir . '/' . $filename;
     $this->assertFileExists($feedbackOutputFile);
     $expectedFile = $this->testExpectedFeedbackOutputDir . '/feedbackSendSuccess.txt';
     $this->assertFileEquals($expectedFile, $feedbackOutputFile);
     $this->deleteOutputFile($filename);
 }
Esempio n. 9
0
 /**
  * @test
  * @group library
  * @ticket SBCMS-891
  * @ticket SBCMS-2393
  */
 public function test_import_importingPagesShouldThrowExceptionAndRemoveImportFiles()
 {
     // ARRANGE
     $importService = new ImportService('Import');
     $websiteId = 'SITE-rs13up2c-exm0-4ea8-a477-4ee79e8e62pa-SITE';
     $config = Registry::getConfig();
     $testImportDirectory = $config->import->directory;
     $testFilesDirectory = $config->test->files->directory;
     $testImportFilename = 'test_pages_export_non_existing_pages_templates_and_modules.zip';
     $testImportFile = FS::joinPath($testFilesDirectory, 'test_exports', $testImportFilename);
     $this->fakedImportFileToDelete = FS::joinPath($testImportDirectory, $testImportFilename);
     $this->importUnzipDirectoryToDelete = str_replace('.zip', '', $this->fakedImportFileToDelete);
     $this->assertFileExists($testImportFile, sprintf("Failed asserting import file '%s' exists", $testImportFile));
     copy($testImportFile, $this->fakedImportFileToDelete);
     mkdir($this->importUnzipDirectoryToDelete);
     // ACT
     try {
         $importService->import($websiteId, $this->fakedImportFileToDelete, null);
         $occurredException = null;
     } catch (\Exception $e) {
         $occurredException = $e;
     }
     // ASSERT
     $this->assertInstanceOf('\\Cms\\Exception', $occurredException);
     $this->assertEquals(25, $occurredException->getCode());
     $this->assertFileNotExists($this->fakedImportFileToDelete, sprintf("Faked import file '%s' wasn't deleted", $this->fakedImportFileToDelete));
     $this->assertFileNotExists($this->importUnzipDirectoryToDelete, sprintf("Import unzip directory '%s' wasn't deleted", $this->importUnzipDirectoryToDelete));
 }
Esempio n. 10
0
 /**
  * @test
  * @group library
  */
 public function copyMediaShouldKeepSourceMediaIds()
 {
     $sourceWebsiteId = 'SITE-mc10e89c-2rtf-46cd-a651-fc42dc7812so-SITE';
     $newWebsiteId = 'SITE-mc1fe89c-2rtf-46cd-a651-fc42dc7f75de-SITE';
     $this->service->copyMediaToNewWebsite($sourceWebsiteId, $newWebsiteId);
     $sourceMedia = $this->service->getByWebsiteIdAndFilter($sourceWebsiteId);
     $sourceMediaIds = array();
     $assertionMessage = 'No expected source media available';
     $this->assertTrue(count($sourceMedia) > 0, $assertionMessage);
     foreach ($sourceMedia as $media) {
         $sourceMediaIds[] = $media->getId();
     }
     $copyMedia = $this->service->getByWebsiteIdAndFilter($newWebsiteId);
     $copyMediaIds = array();
     $assertionMessage = 'No expected copy media available';
     $this->assertTrue(count($copyMedia) > 0, $assertionMessage);
     foreach ($copyMedia as $media) {
         $copyMediaIds[] = $media->getId();
     }
     sort($sourceMediaIds);
     sort($copyMediaIds);
     $assertionMessage = 'Media ids of source and copied media are not identical';
     $this->assertSame($sourceMediaIds, $copyMediaIds, $assertionMessage);
     $config = Registry::getConfig();
     $copiedMediaDirectory = $config->media->files->directory . DIRECTORY_SEPARATOR . $newWebsiteId;
     DirectoryHelper::removeRecursiv($copiedMediaDirectory, $config->media->files->directory);
 }
Esempio n. 11
0
 /**
  * Validate the count value
  *
  * @param  mixed $count
  * @return boolean
  */
 private function validateCount($count)
 {
     $integerValidator = new IntegerValidator();
     $integerValidator->setMessage("Count '%value%' ist keine Zahl", IntegerValidator::INVALID);
     if (!$integerValidator->isValid($count)) {
         $messages = array_values($integerValidator->getMessages());
         $this->addError(new Error('count', $count, $messages));
         return false;
     }
     // !! Achtung: Fehler im Zend Framework Version 1.11.0 !!
     // Der zu pruefende Wert muss groesser als der Parameter 'min' sein.
     // D.h. da der count Parameter mindestens den Wert 1 haben muss,
     // wird als 'min' 0 uebergeben
     $greaterThanValidator = new GreaterThanValidator(array('min' => 0));
     $greaterThanValidator->setMessage("Count '%value%' ist nicht groesser als '%min%'", GreaterThanValidator::NOT_GREATER);
     if (!$greaterThanValidator->isValid($count)) {
         $messages = array_values($greaterThanValidator->getMessages());
         $this->addError(new Error('count', $count, $messages));
         return false;
     }
     $config = Registry::getConfig();
     $configuredUuidLimit = intval($config->uuid->limit);
     $lessThanValidator = new LessThanValidator(array('max' => $configuredUuidLimit));
     $lessThanValidator->setMessage("Count '%value%' ist groesser als das konfigurierte uuid limit '%max%'", LessThanValidator::NOT_LESS);
     if (!$lessThanValidator->isValid($count)) {
         $messages = array_values($lessThanValidator->getMessages());
         $this->addError(new Error('count', $count, $messages));
         return false;
     }
     return true;
 }
 protected function setUp()
 {
     parent::setUp();
     $this->config = Registry::getConfig();
     $this->testMediaFilesDirectory = $this->config->media->files->directory;
     $this->service = new FileService($this->testMediaFilesDirectory);
 }
Esempio n. 13
0
 public function __construct()
 {
     // all ressources added in base class constructor
     parent::__construct();
     // ROLES
     $this->addRole(new \Zend_Acl_Role(self::ROLE_GUEST));
     $this->addRole(new \Zend_Acl_Role(self::ROLE_TICKETUSER), self::ROLE_GUEST);
     $this->addRole(new \Zend_Acl_Role(self::ROLE_USER), self::ROLE_GUEST);
     $this->addRole(new \Zend_Acl_Role(self::ROLE_SUPERUSER), self::ROLE_USER);
     $this->addRole(new \Zend_Acl_Role(self::ROLE_CLIUSER));
     // RULES
     // deny for all users first
     $this->deny();
     $this->allow(self::ROLE_GUEST, self::RESOURCE_ERROR);
     $this->allow(self::ROLE_GUEST, self::RESOURCE_ERROR);
     $this->allow(self::ROLE_GUEST, self::RESOURCE_INDEX, array('index', 'info'));
     $this->allow(self::ROLE_GUEST, self::RESOURCE_USER, array('login', 'validateoptin', 'optin', 'renewpassword', 'logout'));
     $this->allow(self::ROLE_GUEST, self::RESOURCE_LOGIN, array('login'));
     $this->allow(self::ROLE_GUEST, self::RESOURCE_SHORTENER, array('ticket'));
     $this->allow(self::ROLE_GUEST, self::RESOURCE_BUILDER, array('publisherstatuschanged'));
     if (Registry::getConfig()->acl->render_as_guest === true) {
         $this->allow(self::ROLE_GUEST, self::RESOURCE_CDN, array('get'));
         $this->allow(self::ROLE_GUEST, self::RESOURCE_RENDER);
     }
     $this->allow(self::ROLE_TICKETUSER, self::RESOURCE_RENDER);
     $this->allow(self::ROLE_TICKETUSER, self::RESOURCE_CDN, array('get'));
     $this->allow(self::ROLE_TICKETUSER, self::RESOURCE_CREATOR);
     $this->allow(self::ROLE_USER);
     $this->allow(self::ROLE_SUPERUSER);
     $this->deny(null, self::RESOURCE_CLI);
     $this->allow(self::ROLE_CLIUSER, self::RESOURCE_ERROR);
     $this->allow(self::ROLE_CLIUSER, self::RESOURCE_CLI);
 }
Esempio n. 14
0
 /**
  * @param array $nonAllowedArea
  */
 public function __construct(array $nonAllowedAreas = array())
 {
     $this->nonAllowedAreas = $nonAllowedAreas;
     $this->idableAreas = array('pages' => 'Page');
     $this->idablePrivileges = array('edit', 'subAll', 'subEdit');
     $this->requiredRightJsonFields = array('area', 'privilege', 'ids');
     $config = Registry::getConfig();
     $rightsConfig = $config->group->rights;
     $rightsFromConfigAsArray = $rightsConfig->toArray();
     $this->rightMappings = $rightsFromConfigAsArray;
     $this->allowedAreas = array();
     $this->allowedPrivileges = array();
     if (count($rightsFromConfigAsArray) > 0) {
         $this->allowedAreas = array_keys($rightsFromConfigAsArray);
         $allowedPrivileges = array();
         foreach ($rightsFromConfigAsArray as $right) {
             $privileges = array_values($right);
             foreach ($privileges as $privilege) {
                 if (!in_array($privilege, $allowedPrivileges)) {
                     $allowedPrivileges[] = $privilege;
                 }
             }
         }
         $this->allowedPrivileges = $allowedPrivileges;
     }
 }
Esempio n. 15
0
 /**
  * Verschickt ein Feedback-Formular
  * @param array $attributes
  */
 public function send(array $attributes)
 {
     $feedback = new CmsFeedback(Registry::getConfig()->feedback);
     if (isset($attributes['content'])) {
         $feedback->setUserFeedback($attributes['content']);
     }
     if (isset($attributes['email'])) {
         $feedback->setEmail($attributes['email']);
     }
     if (isset($attributes['subject'])) {
         $feedback->setSubject($attributes['subject']);
     }
     if (isset($attributes['userAgent'])) {
         $feedback->setUserAgent($attributes['userAgent']);
     }
     if (isset($attributes['clientErrors'])) {
         $feedback->setClientErrors($attributes['clientErrors']);
     }
     if (isset($attributes['platform'])) {
         $feedback->setPlatform($attributes['platform']);
     }
     try {
         $feedback->send();
     } catch (\Exception $e) {
         throw new \Cms\Exception(1101, __METHOD__, __LINE__, null, $e);
     }
 }
Esempio n. 16
0
 /**
  * @return array
  */
 public function test_configLoadReturnAllMergedConfigAsExpectedProvider()
 {
     $testConfigPath = Registry::getConfig()->test->configs->storage->directory;
     $configPath_allConfigs = FS::joinPath($testConfigPath, 'all_configs');
     $configPath_withLocalConfig = FS::joinPath($testConfigPath, 'with_local-application-ini');
     return array(array('not_exists_env', $configPath_allConfigs, null, null, array('configLoaded' => array('app_php' => true), 'valueFrom' => 'app_php', 'overwritten' => array('from' => 'app_php'))), array('production', $configPath_allConfigs, null, null, array('configLoaded' => array('app_php' => true, 'app_production_php' => true), 'valueFrom' => 'app_production_php', 'overwritten' => array('from' => 'app_production_php'))), array('production', $configPath_allConfigs, FS::joinPath($configPath_allConfigs, 'config.php'), null, array('configLoaded' => array('app_php' => true, 'app_production_php' => true, 'config_php' => true), 'valueFrom' => 'config_php', 'overwritten' => array('from' => 'config_php'))), array('production', $configPath_allConfigs, FS::joinPath($configPath_allConfigs, 'config.php'), FS::joinPath($configPath_allConfigs, 'meta.json'), array('configLoaded' => array('app_php' => true, 'app_production_php' => true, 'config_php' => true), 'valueFrom' => 'config_php', 'overwritten' => array('from' => 'config_php'), 'quota' => 'quota from meta.json', 'owner' => 'owner from meta.json', 'services' => array('someConfig' => 'services.someConfig from meta.json'), 'publisher' => array('externalrukzukservice' => array('tokens' => 'publisher.tokens from meta.json', 'liveHostingDomain' => 'publisher.liveHostingDomain from meta.json')))), array('staging', $configPath_allConfigs, null, null, array('configLoaded' => array('app_php' => true, 'app_staging_php' => true), 'valueFrom' => 'app_staging_php', 'overwritten' => array('from' => 'app_staging_php'))), array('development', $configPath_allConfigs, null, null, array('configLoaded' => array('app_php' => true, 'app_staging_php' => true, 'app_development_php' => true), 'valueFrom' => 'app_development_php', 'overwritten' => array('from' => 'app_development_php'))), array('development', $configPath_allConfigs, FS::joinPath($configPath_allConfigs, 'config.php'), null, array('configLoaded' => array('app_php' => true, 'app_staging_php' => true, 'app_development_php' => true, 'config_php' => true), 'valueFrom' => 'config_php', 'overwritten' => array('from' => 'config_php'))), array('development', $configPath_withLocalConfig, null, null, array('configLoaded' => array('app_php' => true, 'app_staging_php' => true, 'app_development_php' => true, 'local-application_ini-production' => 1, 'local-application_ini-staging' => 2, 'local-application_ini-development' => 3), 'valueFrom' => 'local-application_ini:development', 'overwritten' => array('from' => 'local-application_ini:development'))));
 }
Esempio n. 17
0
 /**
  * @test
  * @group library
  */
 public function successfullyDecompressGzRawPostData()
 {
     $compressedRequestFileDirectory = Registry::getConfig()->test->request->storage->directory . DIRECTORY_SEPARATOR . 'compressed' . DIRECTORY_SEPARATOR;
     $compressedRawBodyFile = $compressedRequestFileDirectory . 'gzCompressed.body';
     $decompressedParamFile = $compressedRequestFileDirectory . 'gzDeompressedParams.php';
     $this->assertFileExists($compressedRawBodyFile, 'Komprimierte Test-Request-Datei nicht gefunden: ' . $compressedRawBodyFile);
     $this->assertFileExists($decompressedParamFile, 'Dekomprimierte Test-Param-Variablen-Datei nicht gefunden: ' . $decompressedParamFile);
     // Dekomprimierte Werte ermitteln
     $decompressedParams = (include $decompressedParamFile);
     // Request-Objekt erzeugen
     $request = new HttpRequestCompressed();
     // Raw Post Daten setzen
     $_SERVER['REQUEST_METHOD'] = 'POST';
     $_SERVER['HTTP_X_CMS_ENCODING'] = 'gz';
     $reflectionClass = new \ReflectionClass('Cms\\Controller\\Request\\HttpCompressed');
     $reflectionPropertyDecompressedFlag = $reflectionClass->getProperty('postDataDecompressed');
     $reflectionPropertyDecompressedFlag->setAccessible(true);
     $reflectionPropertyDecompressedFlag->setValue($request, false);
     $reflectionPropertyRawBody = $reflectionClass->getProperty('_rawBody');
     $reflectionPropertyRawBody->setAccessible(true);
     $reflectionPropertyRawBody->setValue($request, file_get_contents($compressedRawBodyFile));
     // Dekomprimieren
     $request->decompressRequest();
     // Dekomprimierung pruefen
     $jsonParams = $request->getParam(\Cms\Request\Base::REQUEST_PARAMETER);
     $this->assertInternalType('string', $jsonParams);
     $params = json_decode($jsonParams, true);
     $this->assertInternalType('array', $params);
     $this->assertSame($decompressedParams, $params);
 }
Esempio n. 18
0
 /**
  * @test
  * @group integration
  */
 public function getWebsiteBuildsShouldReturnBuilds()
 {
     $comment = 'test_website_build_comment';
     $websiteId = 'SITE-bw02fg14-3bbe-4301-ae51-f58464f1708e-SITE';
     $config = Registry::getConfig();
     $expectedWebsiteBuildsCount = (int) $config->builds->threshold;
     $request = sprintf('/builder/getwebsitebuilds/params/{"websiteid":"%s"}', $websiteId);
     $this->copyWebsiteBuildsFromStorageToBuildsDirectory($websiteId);
     $this->dispatch($request);
     $response = $this->getResponseBody();
     $response = new Response($response);
     $this->assertTrue($response->getSuccess());
     $responseData = $response->getData();
     $this->assertObjectHasAttribute('builds', $responseData);
     $this->assertNotEmpty($responseData->builds);
     $this->assertInternalType('array', $responseData->builds);
     $this->assertSame($expectedWebsiteBuildsCount, count($responseData->builds));
     foreach ($responseData->builds as $nextBuild) {
         $this->assertObjectHasAttribute('id', $nextBuild);
         $this->assertObjectHasAttribute('version', $nextBuild);
         $this->assertObjectHasAttribute('timestamp', $nextBuild);
         $this->assertObjectHasAttribute('comment', $nextBuild);
         $this->assertObjectHasAttribute('creatorName', $nextBuild);
         $this->assertObjectHasAttribute('lastPublished', $nextBuild);
         $this->assertInternalType('object', $nextBuild->lastPublished);
         $this->assertObjectHasAttribute('id', $nextBuild->lastPublished);
         $this->assertObjectHasAttribute('status', $nextBuild->lastPublished);
         $this->assertObjectHasAttribute('timestamp', $nextBuild->lastPublished);
         $this->assertObjectHasAttribute('percent', $nextBuild->lastPublished);
         $this->assertObjectHasAttribute('remaining', $nextBuild->lastPublished);
         $this->assertObjectHasAttribute('msg', $nextBuild->lastPublished);
     }
 }
Esempio n. 19
0
 public function loginAction()
 {
     $config = Registry::getConfig();
     $this->view->loginFailed = false;
     // Bereits angemeldete User direkt weiterleiten
     if ($this->isUserDeclared()) {
         $this->_redirect(base64_decode($this->getRequest()->getParam('url')), array('prependBase' => false));
     }
     if ($this->getRequest()->getPost('login')) {
         $username = $this->getRequest()->getPost('username');
         $userpassword = $this->getRequest()->getPost('password');
         if ($this->tryUserLogin($username, $userpassword)) {
             $this->_redirect(base64_decode($this->getRequest()->getPost('url')), array('prependBase' => false));
         }
         // Ticket-Login mit den Zugangsdaten auf den Ticket-Service weiterleiten
         if ($this->getRequest()->getPost('ticket')) {
             $credentials = \Zend_Json::encode(array('username' => $username, 'password' => $userpassword));
             $url = base64_decode($this->getRequest()->getParam('url'));
             if (substr($url, -1, 1) != '/') {
                 $url .= '/';
             }
             $url .= $config->request->parameter . '/' . urlencode($credentials);
             $this->_redirect($url, array('prependBase' => false));
         }
         $this->view->loginFailed = true;
     }
     $this->view->url = $this->getRequest()->getParam('url');
     $this->view->useClientTemplate = realpath($config->client->template->login);
     // Ticket-Daten aufnehmen
     if ($this->getRequest()->getParam('ticket') == 2) {
         $this->view->loginFailed = true;
     }
     $this->view->ticket = $this->getRequest()->getParam('ticket');
 }
Esempio n. 20
0
 public function exportAction()
 {
     $data = $this->getRequest()->getParam(BaseRequest::REQUEST_PARAMETER);
     if ($data == null) {
         $error['success'] = false;
         $error['errors'] = array('code' => 1, 'message' => 'Unvollstaendiger Request');
         $this->view->error = json_encode($error);
         $this->_helper->viewRenderer->setNoRender(false);
         $this->_helper->viewRenderer('error');
     } else {
         $dataParams = new ArrayObject(json_decode($data));
         $exportName = $dataParams['name'];
         /** @var $exportBusiness \Cms\Business\Export */
         $exportBusiness = $this->getBusiness('Export');
         $config = Registry::getConfig();
         $exportBaseDirectory = $config->export->directory;
         $exportDirectory = $exportBaseDirectory . DIRECTORY_SEPARATOR . md5($exportName);
         $exportZipFile = $exportBaseDirectory . DIRECTORY_SEPARATOR . md5($exportName) . DIRECTORY_SEPARATOR . md5($exportName) . '.' . $exportBusiness::EXPORT_FILE_EXTENSION;
         $exportZipFileName = $exportName . '.' . $exportBusiness::EXPORT_FILE_EXTENSION;
         if (!is_dir($exportDirectory) || !file_exists($exportZipFile)) {
             $error['success'] = false;
             $error['errors'] = array('code' => 1, 'message' => null);
             if (!is_dir($exportDirectory)) {
                 $error['errors']['message'] = sprintf("Export Verzeichniss '%s' existiert nicht", $exportDirectory);
             } elseif (!file_exists($exportZipFile)) {
                 $error['errors']['message'] = sprintf("Export Datei '%s' existiert nicht", $exportZipFile);
             }
             $this->view->error = json_encode($error);
             $this->_helper->viewRenderer->setNoRender(false);
             $this->_helper->viewRenderer('error');
         } else {
             $fileModificationTime = filemtime($exportZipFile);
             $fileModificationTimeForHeader = gmdate('D, j M Y H:i:s T', $fileModificationTime);
             $response = $this->getResponse();
             $response->setHeader('Content-Type', Mimetype::getMimetype($exportZipFile));
             $response->setHeader('Content-Disposition', 'attachment; filename="' . $exportZipFileName . '"');
             $response->setHeader('Last-Modified', $fileModificationTimeForHeader);
             $response->setHeader('Content-Length', filesize($exportZipFile));
             $response->setOutputBodyCallback(function ($response, $chunkSize) use($exportZipFile, $exportDirectory) {
                 if (is_file($exportZipFile) && is_readable($exportZipFile)) {
                     $fd = fopen($exportZipFile, 'rb');
                     if ($fd !== false) {
                         while (!feof($fd) && !connection_aborted()) {
                             print fread($fd, $chunkSize);
                             $response->flushOutput();
                         }
                         fclose($fd);
                     }
                 }
                 if (is_file($exportZipFile)) {
                     @unlink($exportZipFile);
                 }
                 if (is_dir($exportDirectory)) {
                     @rmdir($exportDirectory);
                 }
             });
         }
     }
 }
Esempio n. 21
0
 /**
  * @param  string  $name
  * @return Cms\Publisher
  * @throws Cms\Exception
  */
 public static function getPublisherName($name)
 {
     if (isset($name)) {
         return $name;
     } else {
         return Registry::getConfig()->publisher->type;
     }
 }
Esempio n. 22
0
 protected function updateConfigModuleEnableDev($enable)
 {
     // set quota in config
     $newConfig = new \Zend_Config(Registry::getConfig()->toArray(), true);
     $newConfig->quota->module->enableDev = $enable;
     $newConfig->setReadOnly();
     Registry::setConfig($newConfig);
 }
Esempio n. 23
0
 protected function tearDown()
 {
     if (\Seitenbau\Registry::getConfig()->screens->activ != false && \Seitenbau\Registry::getConfig()->screens->activ != "no") {
         $screenshotWebsiteDir = \Seitenbau\Registry::getConfig()->screens->directory . DIRECTORY_SEPARATOR . $this->websiteId . DIRECTORY_SEPARATOR;
         $this->removeDir($screenshotWebsiteDir);
     }
     parent::tearDown();
 }
Esempio n. 24
0
 /**
  * @test
  * @group library
  */
 public function setImageFileShouldThrowExceptionOnNonExistingImagefile()
 {
     $testFilesDirectory = Registry::getConfig()->test->files->directory;
     $imageFile = $testFilesDirectory . DIRECTORY_SEPARATOR . 'imageprocessing' . DIRECTORY_SEPARATOR . 'not_existing_file.jpg';
     $imageTool = \Seitenbau\Image::factory($this->imageConfig->toArray());
     $this->setExpectedException('\\Seitenbau\\Image\\ImageException');
     $imageTool->setFile($imageFile);
 }
Esempio n. 25
0
 protected function setUp()
 {
     parent::setUp();
     $this->activateGroupCheck();
     $config = Registry::getConfig();
     $this->testDirExpectedResultFiles = $config->test->response->render->directory;
     $this->testOutputDir = $config->test->output->response->render->directory;
 }
Esempio n. 26
0
 protected function _initOriginalConfig()
 {
     $this->bootstrap('config');
     // at first call, set the original config
     if (!ConfigHelper::hasOriginalConfig()) {
         ConfigHelper::setOriginalConfig(Registry::getConfig());
     }
 }
Esempio n. 27
0
 /**
  * @return string
  */
 protected function getDaoName()
 {
     $serviceConfig = Registry::getConfig()->service;
     if (isset($serviceConfig->{$this->servicename}) && isset($serviceConfig->{$this->servicename}->dao)) {
         return $serviceConfig->{$this->servicename}->dao;
     } else {
         return $this->servicename;
     }
 }
Esempio n. 28
0
 protected function setUp()
 {
     // Parent aufrufen
     parent::setUp();
     $this->config = ConfigHelper::getWritableConfig(Registry::getConfig()->screens);
     $this->config->activ = 'yes';
     $this->config->type = 'Phpimagegrabwindow';
     $this->screenshotTypeHandler = new Screenshot\Type\Phpimagegrabwindow($this->config->toArray());
 }
 protected function setUp()
 {
     parent::setUp();
     $weburl = parse_url(Registry::getBaseUrl());
     $this->spaceHost = preg_replace('/\\.$/', '', $weburl['host']);
     $this->cfg_segmentio = Registry::getConfig()->stats->segmentio->toArray();
     $this->analyticsLogFile = $this->cfg_segmentio['api_options']['filename'];
     FS::rmFile($this->analyticsLogFile);
 }
Esempio n. 30
0
 protected function getPublicUrlEndpoints()
 {
     $urls = array();
     $cfg = Registry::getConfig();
     if (isset($cfg->services)) {
         $urls['linkResolver'] = $cfg->services->linkResolver;
     }
     return $urls;
 }