コード例 #1
0
 public function testEmulateSession()
 {
     $sessionVars = $this->_getSessionVars();
     $this->assertEmpty(session_id());
     $actualResult = ['session_data_to_be_erased' => 'some_value'];
     $this->_object->emulateSession($actualResult);
     $this->assertEquals([], $actualResult);
     $this->assertSame($sessionVars, $this->_getSessionVars(), 'Super-global $_SESSION must not be affected.');
     $this->assertNotEmpty(session_id(), 'Global session identified has to be emulated.');
 }
コード例 #2
0
ファイル: BootstrapTest.php プロジェクト: aiesh/magento2
 public function testRunBootstrapEnvironment()
 {
     $this->_injectApplicationMock();
     $this->_envBootstrap->expects($this->once())->method('emulateHttpRequest')->with($this->identicalTo($_SERVER));
     $this->_envBootstrap->expects($this->once())->method('emulateSession')->with($this->identicalTo(isset($_SESSION) ? $_SESSION : null));
     $this->_object->runBootstrap();
 }
コード例 #3
0
 public function testRunBootstrap()
 {
     $this->_envBootstrap->expects($this->once())->method('emulateHttpRequest')->with($this->identicalTo($_SERVER));
     $this->_envBootstrap->expects($this->once())->method('emulateSession')->with($this->identicalTo(isset($_SESSION) ? $_SESSION : null));
     $memUsageLimit = '100B';
     $memLeakLimit = '60B';
     $settingsMap = [['TESTS_MEM_USAGE_LIMIT', 0, $memUsageLimit], ['TESTS_MEM_LEAK_LIMIT', 0, $memLeakLimit]];
     $this->_settings->expects($this->any())->method('get')->will($this->returnValueMap($settingsMap));
     $memoryBootstrap = $this->getMock('Magento\\TestFramework\\Bootstrap\\Memory', ['activateStatsDisplaying', 'activateLimitValidation'], [], '', false);
     $memoryBootstrap->expects($this->once())->method('activateStatsDisplaying');
     $memoryBootstrap->expects($this->once())->method('activateLimitValidation');
     $this->memoryFactory->expects($this->once())->method('create')->with($memUsageLimit, $memLeakLimit)->will($this->returnValue($memoryBootstrap));
     $this->_docBlockBootstrap->expects($this->once())->method('registerAnnotations')->with($this->isInstanceOf('Magento\\TestFramework\\Application'));
     $this->_profilerBootstrap->expects($this->never())->method($this->anything());
     $this->_object->runBootstrap();
 }
コード例 #4
0
ファイル: Bootstrap.php プロジェクト: aiesh/magento2
 /**
  * Perform bootstrap actions required to completely setup the testing environment
  */
 public function runBootstrap()
 {
     $this->_envBootstrap->emulateHttpRequest($_SERVER);
     $this->_envBootstrap->emulateSession($_SESSION);
     $profilerOutputFile = $this->_settings->getAsFile('TESTS_PROFILER_FILE');
     if ($profilerOutputFile) {
         $this->_profilerBootstrap->registerFileProfiler($profilerOutputFile);
     }
     $profilerOutputFile = $this->_settings->getAsFile('TESTS_BAMBOO_PROFILER_FILE');
     $profilerMetricsFile = $this->_settings->getAsFile('TESTS_BAMBOO_PROFILER_METRICS_FILE');
     if ($profilerOutputFile && $profilerMetricsFile) {
         $this->_profilerBootstrap->registerBambooProfiler($profilerOutputFile, $profilerMetricsFile);
     }
     $memoryBootstrap = $this->_createMemoryBootstrap($this->_settings->get('TESTS_MEM_USAGE_LIMIT', 0), $this->_settings->get('TESTS_MEM_LEAK_LIMIT', 0));
     $memoryBootstrap->activateStatsDisplaying();
     $memoryBootstrap->activateLimitValidation();
     $this->_docBlockBootstrap->registerAnnotations($this->_application);
     if ($this->_settings->getAsBoolean('TESTS_CLEANUP')) {
         $this->_application->cleanup();
     }
     if ($this->_application->isInstalled()) {
         $this->_application->initialize();
     } else {
         $this->_application->install(self::ADMIN_NAME, self::ADMIN_PASSWORD, self::ADMIN_ROLE_NAME);
     }
 }
コード例 #5
0
ファイル: Bootstrap.php プロジェクト: tingyeeh/magento2
 /**
  * Perform bootstrap actions required to completely setup the testing environment
  */
 public function runBootstrap()
 {
     $this->_envBootstrap->emulateHttpRequest($_SERVER);
     $this->_envBootstrap->emulateSession($_SESSION);
     $profilerOutputFile = $this->_settings->getAsFile('TESTS_PROFILER_FILE');
     if ($profilerOutputFile) {
         $this->_profilerBootstrap->registerFileProfiler($profilerOutputFile);
     }
     $profilerBambooOutputFile = $this->_settings->getAsFile('TESTS_BAMBOO_PROFILER_FILE');
     $profilerBambooMetricsFile = $this->_settings->getAsFile('TESTS_BAMBOO_PROFILER_METRICS_FILE');
     if ($profilerBambooOutputFile && $profilerBambooMetricsFile) {
         $this->_profilerBootstrap->registerBambooProfiler($profilerBambooOutputFile, $profilerBambooMetricsFile);
     }
     $memoryBootstrap = $this->memoryFactory->create($this->_settings->get('TESTS_MEM_USAGE_LIMIT', 0), $this->_settings->get('TESTS_MEM_LEAK_LIMIT', 0));
     $memoryBootstrap->activateStatsDisplaying();
     $memoryBootstrap->activateLimitValidation();
     $this->_docBlockBootstrap->registerAnnotations($this->_application);
 }