Пример #1
0
 public function testDispatch()
 {
     if (!Magento_Test_Bootstrap::canTestHeaders()) {
         $this->markTestSkipped('Cant\'t test dispatch process without sending headers');
     }
     $_SERVER['HTTP_HOST'] = 'localhost';
     $this->_model->init();
     /* empty action */
     $this->_model->getRequest()->setRequestUri('core/index/index');
     $this->_model->dispatch();
     $this->assertEmpty($this->_model->getResponse()->getBody());
 }
Пример #2
0
 public function testMatch()
 {
     if (!Magento_Test_Bootstrap::canTestHeaders()) {
         $this->markTestSkipped('Can\'t test get match without sending headers');
     }
     $request = new Magento_Test_Request();
     $this->assertNull($this->_model->match($request));
     $this->_model->collectRoutes('frontend', 'standard');
     $this->assertInstanceOf('Mage_Core_Controller_Varien_Action', $this->_model->match($request));
     $request->setRequestUri('core/index/index');
     $this->assertInstanceOf('Mage_Core_Controller_Varien_Action', $this->_model->match($request));
     $request->setPathInfo('not_exists/not_exists/not_exists')->setModuleName('not_exists')->setControllerName('not_exists')->setActionName('not_exists');
     $this->assertNull($this->_model->match($request));
 }
Пример #3
0
 public function testSetGetResponse()
 {
     if (!Magento_Test_Bootstrap::canTestHeaders()) {
         $this->markTestSkipped('Can\'t test get response without sending headers');
     }
     $this->assertInstanceOf('Mage_Core_Controller_Response_Http', $this->_model->getResponse());
     $this->_model->setResponse(new Magento_Test_Response());
     $this->assertInstanceOf('Magento_Test_Response', $this->_model->getResponse());
 }
Пример #4
0
 public function testCanTestHeaders()
 {
     if (!function_exists('xdebug_get_headers')) {
         $this->assertFalse(Magento_Test_Bootstrap::canTestHeaders(), 'Expected inability to test headers.');
         return;
     }
     $expectedHeader = 'SomeHeader: header-value';
     $expectedCookie = 'Set-Cookie: SomeCookie=cookie-value';
     /* Make sure that chosen reference samples are unique enough to rely on them */
     $actualHeaders = xdebug_get_headers();
     $this->assertNotContains($expectedHeader, $actualHeaders);
     $this->assertNotContains($expectedCookie, $actualHeaders);
     /* Determine whether header-related functions can be in fact called with no error */
     $expectedCanTest = true;
     set_error_handler(function () use(&$expectedCanTest) {
         $expectedCanTest = false;
     });
     header($expectedHeader);
     setcookie('SomeCookie', 'cookie-value');
     restore_error_handler();
     $this->assertEquals($expectedCanTest, Magento_Test_Bootstrap::canTestHeaders());
     if ($expectedCanTest) {
         $actualHeaders = xdebug_get_headers();
         $this->assertContains($expectedHeader, $actualHeaders);
         $this->assertContains($expectedCookie, $actualHeaders);
     }
 }
Пример #5
0
 public function testProcessRequestTrue()
 {
     if (!Magento_Test_Bootstrap::canTestHeaders()) {
         $this->markTestSkipped('Test requires to send headers.');
     }
     $model = new Mage_Core_Model_Cache(array('request_processors' => array('Mage_Core_Model_CacheTestRequestProcessor')));
     Mage_Core_Model_CacheTestRequestProcessor::$isEnabled = true;
     $this->assertTrue($model->processRequest());
 }
Пример #6
0
 /**
  * @todo refactor Mage_Core_Model_Store::getPriceFilter, it can return two different types
  */
 public function testGetPriceFilter()
 {
     if (!Magento_Test_Bootstrap::canTestHeaders()) {
         $this->markTestSkipped('Currency operations use cookie and require ability to send headers.');
     }
     $this->assertInstanceOf('Mage_Directory_Model_Currency_Filter', $this->_model->getPriceFilter());
 }