/**
  * @test
  * @group small
  * @group library
  *
  * @dataProvider test_publishShouldCallUrlsAsExpectedProvider
  */
 public function test_publishShouldCallUrlsAsExpected($websiteId, $publishingId, $publishingFilePath, $publishConfig, $serviceUrls, $expectedToken)
 {
     // ARRANGE
     $expectedHost = 'TEST_PUBLISHER_HOST';
     $expectedEndpoints = array('publish' => array('url' => '/THIS/IS/THE/PUBLISHER/ADD/URL/', 'timeout' => 11, 'maxRedirects' => 11), 'status' => array('url' => '/THIS/IS/THE/PUBLISHER/STATUS/URL/', 'timeout' => 22, 'maxRedirects' => 22));
     ConfigHelper::removeValue(array('publisher', 'externalrukzukservice', 'hosts'));
     ConfigHelper::mergeIntoConfig(array('publisher' => array('externalrukzukservice' => array('hosts' => array($expectedHost), 'endpoint' => $expectedEndpoints))));
     $httpClientMock = $this->getHttpClientMock();
     $httpClientMock->mock_addMethodReturn('callUrl', 200, array());
     $httpClientMock->mock_addMethodReturn('callUrl', 200, array());
     $publisherMock = $this->getPublisherMock($httpClientMock);
     $publisherVersion = $publisherMock::VERSION;
     // ACT
     $actualPublishedStatus = $publisherMock->publish($websiteId, $publishingId, $publishingFilePath, $publishConfig, $serviceUrls);
     // ASSERT
     $methodCalls = $httpClientMock->mock_getMethodCalls();
     $this->assertCount(2, $methodCalls);
     // assert publish call
     $publishRequest = $expectedEndpoints['publish'];
     $publishRequest['params'] = array('data' => json_encode($publishConfig), 'client_version' => $publisherVersion, 'token' => $expectedToken, 'download_url' => $serviceUrls['download'], 'status_url' => $serviceUrls['status']);
     $this->assertHttpClientCall($methodCalls[0], array('host' => $expectedHost, 'request' => $publishRequest));
     // assert status call
     $statusRequest = $expectedEndpoints['status'];
     $statusRequest['params'] = array('client_version' => $publisherVersion, 'token' => $expectedToken, 'download_url' => $serviceUrls['download'], 'status_url' => $serviceUrls['status']);
     $this->assertHttpClientCall($methodCalls[1], array('host' => $expectedHost, 'request' => $statusRequest));
 }
Exemple #2
0
 /**
  * @test
  * @group library
  * @expectedException \Cms\Exception
  * @expectedExceptionCode 2302
  */
 public function test_exportTemplatesnippetShouldThrowQuotaExceptionAsExpected()
 {
     // ARRANGE
     ConfigHelper::mergeIntoConfig(array('quota' => array('exportAllowed' => false)));
     // ACT
     $this->business->export(ExportBusiness::EXPORT_MODE_TEMPLATESNIPPET, 'WEBSITE-ID', array());
 }
 /**
  * @return array
  */
 protected function setDefaultPublishDataIntoConfig()
 {
     $type = __CLASS__ . '::' . __METHOD__ . '::' . microtime();
     $defaultConfig = array('foo' => 'bar', 'bar' => 'foo', 'test' => array('active' => true));
     ConfigHelper::mergeIntoConfig(array('publisher' => array('defaultPublish' => array('type' => $type, 'config' => array($type => $defaultConfig)))));
     $defaultConfig['type'] = $type;
     return $defaultConfig;
 }
Exemple #4
0
 /**
  * @test
  * @group library
  */
 public function test_createUserShouldSendRegisterMailAsExpected()
 {
     ConfigHelper::mergeIntoConfig(array('user' => array('mail' => array('optin' => array('from' => array('adress' => '*****@*****.**', 'name' => 'rukzuk-testrun-init-system'))))));
     $userCreateValues = array('email' => '*****@*****.**', 'lastname' => 'phpunit_2', 'firstname' => 'test_2', 'isSuperuser' => true, 'isDeletable' => false);
     $user = $this->business->createUser($userCreateValues, true);
     $this->assertUserCreatedSuccessfully($userCreateValues, $user);
     $this->asserUserExists($user->getId(), $userCreateValues);
     $this->assertRegisterMailSend($user);
 }
 protected function setUp()
 {
     parent::setUp();
     $this->testService = new WebhostingQuotaTestWebsiteService('Website');
     // reset calls and set website count
     $this->testService->resetPhpunitTestCalls();
     // set webhosting max count quota
     ConfigHelper::mergeIntoConfig(array('quota' => array('webhosting' => array('maxCount' => $this->testWebhostingMaxCount))));
 }
Exemple #6
0
 protected function setUp()
 {
     parent::setUp();
     $this->testService = new WebsiteTestService('Website');
     // reset calls and set website count
     $this->testService->restPhpunitTestCalls();
     $this->testService->setPhpunitTestWebsiteCount(5);
     // set quota in config
     ConfigHelper::mergeIntoConfig(array('quota' => array('website' => array('maxCount' => 5))));
 }
Exemple #7
0
 /**
  * @test
  * @group small
  * @group library
  */
 public function test_publish_shouldPublishAsExpected()
 {
     // ARRANGE
     ConfigHelper::mergeIntoConfig(array('publisher' => array('type' => 'standalone')));
     $websiteId = 'INTERNAL_THIS_IS_THE_WEBSITE_ID';
     $shortId = 'THIS_IS_THE_SHORT_ID';
     $publishingId = 'INTERNAL_THIS_IS_THE_PUBLISHING_ID';
     $cname = 'internal.my.live.domain.intern';
     $publishingFilePath = FS::joinPath($this->getTestFileDirectory(), 'publishing_file.zip');
     $publishConfig = array('type' => 'internal', 'cname' => $cname, 'shortId' => $shortId);
     $serviceUrls = array('download' => '/INTERNAL/service/endpoint/for/download/website/zip', 'status' => '/INTERNAL/service/endpoint/for/status/request');
     $expectedFilePathname = FS::joinPath($this->getTestFileDirectory(), 'expected_live_tree.json');
     $expectedFileTree = json_decode(FS::readContentFromFile($expectedFilePathname), true);
     $outputLiveDirectory = $this->getOutputDirectoryForShortId($shortId);
     // ACT
     $actualPublishedStatus = $this->getPublisher()->publish($websiteId, $publishingId, $publishingFilePath, $publishConfig, $serviceUrls);
     // ASSERT
     $this->assertInstanceOf('\\Cms\\Data\\PublisherStatus', $actualPublishedStatus);
     $this->assertSame($actualPublishedStatus::STATUS_FINISHED, $actualPublishedStatus->getStatus());
     $actualFileTreeAsJson = DirectoryHelper::getRecursive($outputLiveDirectory);
     $this->assertEquals($expectedFileTree, $actualFileTreeAsJson);
     $this->assertCnameLinksExists($this->getOutputDirectory(), $cname, $outputLiveDirectory);
     $this->assertDirectoryIsEmpty($this->getTempDirectory());
 }
Exemple #8
0
 /**
  * @test
  *
  * @group quota
  * @group small
  * @group dev
  */
 public function test_getMediaQuotaSuccess()
 {
     // ARRANGE
     $expectedMaxFileSize = 12345;
     $expectedMaxSizePerWebsite = 67890;
     ConfigHelper::mergeIntoConfig(array('quota' => array('media' => array('maxFileSize' => $expectedMaxFileSize, 'maxSizePerWebsite' => $expectedMaxSizePerWebsite))));
     // ACT
     $quota = new Quota();
     $actualMediaQuota = $quota->getMediaQuota();
     // ASSERT
     $actualMaxFileSize = $actualMediaQuota->getMaxFileSize();
     $this->assertEquals($expectedMaxFileSize, $actualMaxFileSize);
     $actualMaxSizePerWebsite = $actualMediaQuota->getMaxSizePerWebsite();
     $this->assertEquals($expectedMaxSizePerWebsite, $actualMaxSizePerWebsite);
 }
 protected function enableAnalytics($trackingId)
 {
     ConfigHelper::mergeIntoConfig(array('stats' => array('segmentio' => array('enabled' => 1)), 'owner' => array('trackingId' => $trackingId)));
 }
 /**
  * @param array|\Zend_Config $config
  * @throws \Exception
  */
 protected function mergeIntoConfig($config)
 {
     ConfigHelper::mergeIntoConfig($config);
 }
Exemple #11
0
 protected function updateConfigModuleEnableDev($enable)
 {
     // set quota in config
     ConfigHelper::mergeIntoConfig(array('quota' => array('module' => array('enableDev' => $enable))));
 }
Exemple #12
0
 /**
  * @param  string  $mode
  * @param  integer $value
  * @return mixed
  */
 public static function changeConfiguredLifetime($mode, $value)
 {
     $formerLifetime = Registry::getConfig()->optin->lifetime->{$mode};
     ConfigHelper::mergeIntoConfig(array('optin' => array('lifetime' => array($mode => $value))));
     \PHPUnit_Framework_Assert::assertEquals($value, Registry::getConfig()->optin->lifetime->{$mode});
     return $formerLifetime;
 }
Exemple #13
0
 /**
  * angegebener Adapter in der Config kann nicht initialisiert werden
  *
  * @test
  * @group library
  * @expectedException \Cms\Feedback\Exception
  */
 public function constructInitAdapterFailed()
 {
     ConfigHelper::mergeIntoConfig(array('feedback' => array('adapter' => 'gibtesnicht123')));
     $feedback = new Feedback(Registry::getConfig()->feedback);
 }
Exemple #14
0
 /**
  * @test
  * @group library
  * @expectedException \Cms\Mail\Exception
  */
 public function constructShouldReturnExceptionOnInvalidTransport()
 {
     ConfigHelper::mergeIntoConfig(array('mail' => array('transport' => 'gibtEsNicht')));
     $mail = new Mail();
 }