getMagentoMajorVersion() public method

public getMagentoMajorVersion ( ) : integer
return integer
Example #1
0
 /**
  * @return PHPUnit_Framework_MockObject_MockObject|Application
  */
 public function getApplication()
 {
     if ($this->application === null) {
         $root = $this->getTestMagentoRoot();
         $this->application = $this->getMock('N98\\Magento\\Application', array('getMagentoRootFolder'));
         $loader = (require __DIR__ . '/../../../../../vendor/autoload.php');
         $this->application->setAutoloader($loader);
         $this->application->expects($this->any())->method('getMagentoRootFolder')->will($this->returnValue($root));
         $this->application->init();
         $this->application->initMagento();
         if ($this->application->getMagentoMajorVersion() == Application::MAGENTO_MAJOR_VERSION_1) {
             spl_autoload_unregister(array(\Varien_Autoload::instance(), 'autoload'));
         }
     }
     return $this->application;
 }
Example #2
0
 /**
  * @throws \RuntimeException
  * @return PHPUnit_Framework_MockObject_MockObject|\N98\Magento\Application
  */
 public function getApplication()
 {
     if ($this->application === null) {
         $root = getenv('N98_MAGERUN_TEST_MAGENTO_ROOT');
         if (empty($root)) {
             throw new \RuntimeException('Please specify environment variable N98_MAGERUN_TEST_MAGENTO_ROOT with path to your test
                 magento installation!');
         }
         $this->application = $this->getMock('N98\\Magento\\Application', array('getMagentoRootFolder'));
         $loader = (require __DIR__ . '/../../../../../vendor/autoload.php');
         $this->application->setAutoloader($loader);
         $this->application->expects($this->any())->method('getMagentoRootFolder')->will($this->returnValue($root));
         $this->application->init();
         $this->application->initMagento();
         if ($this->application->getMagentoMajorVersion() == Application::MAGENTO_MAJOR_VERSION_1) {
             spl_autoload_unregister(array(\Varien_Autoload::instance(), 'autoload'));
         }
     }
     return $this->application;
 }