public function testVersionNotifyWithModulesInShop()
 {
     $oCaller = $this->getMock('oxOnlineModuleVersionNotifierCaller', array('doRequest'), array(), '', false);
     $oCaller->expects($this->any())->method('doRequest');
     $oModule = $this->getMock('oxModule');
     $oModuleList = $this->getMock('oxModuleList', array('getList'));
     $oModuleList->expects($this->any())->method('getList')->will($this->returnValue(array($oModule)));
     $oNotifier = new oxOnlineModuleVersionNotifier($oCaller, $oModuleList);
     $oNotifier->versionNotify();
 }
 /**
  * Tests if module was activated.
  */
 public function testVersionNotify()
 {
     $oEnvironment = new Environment();
     $oEnvironment->prepare(array('extending_1_class', 'extending_1_class_3_extensions', 'with_everything'));
     /** @var oxOnlineModuleVersionNotifierCaller|PHPUnit_Framework_MockObject_MockObject $oCaller */
     $oCaller = $this->getMock('oxOnlineModuleVersionNotifierCaller', array('doRequest'), array(), '', false);
     $oCaller->expects($this->any())->method('doRequest')->with($this->equalTo($this->getExpectedRequest()));
     $oModuleList = oxNew('oxModuleList');
     $sModuleDir = realpath(dirname(__FILE__)) . '/testData/modules';
     $oModuleList->getModulesFromDir($sModuleDir);
     $oNotifier = new oxOnlineModuleVersionNotifier($oCaller, $oModuleList);
     $oNotifier->versionNotify();
 }
 public function testRequestFormation()
 {
     $oConfig = oxRegistry::getConfig();
     $oConfig->setConfigParam('sClusterId', array('generated_unique_cluster_id'));
     $sEdition = $oConfig->getEdition();
     $sVersion = $oConfig->getVersion();
     $sShopUrl = $oConfig->getShopUrl();
     $sXml = '<?xml version="1.0" encoding="utf-8"?>' . "\n";
     $sXml .= '<omvnRequest>';
     $sXml .= '<pVersion>1.1</pVersion>';
     $sXml .= '<modules>';
     $sXml .= '<module>';
     $sXml .= '<id>moduleId1</id>';
     $sXml .= '<version>1.0</version>';
     $sXml .= "<activeInShops><activeInShop>{$sShopUrl}</activeInShop></activeInShops>";
     $sXml .= '</module>';
     $sXml .= '<module>';
     $sXml .= '<id>moduleId2</id>';
     $sXml .= '<version>2.0</version>';
     $sXml .= "<activeInShops><activeInShop>{$sShopUrl}</activeInShop></activeInShops>";
     $sXml .= '</module>';
     $sXml .= '</modules>';
     $sXml .= '<clusterId>generated_unique_cluster_id</clusterId>';
     $sXml .= "<edition>{$sEdition}</edition>";
     $sXml .= "<version>{$sVersion}</version>";
     $sXml .= "<shopUrl>{$sShopUrl}</shopUrl>";
     $sXml .= '<productId>eShop</productId>';
     $sXml .= '</omvnRequest>' . "\n";
     $oCurl = $this->getMock('oxCurl', array('setParameters', 'execute'));
     $oCurl->expects($this->atLeastOnce())->method('setParameters')->with($this->equalTo(array('xmlRequest' => $sXml)));
     $oCurl->expects($this->any())->method('execute')->will($this->returnValue(true));
     /** @var oxCurl $oCurl */
     $oEmailBuilder = oxNew('oxOnlineServerEmailBuilder');
     $oOnlineModuleVersionNotifierCaller = new oxOnlineModuleVersionNotifierCaller($oCurl, $oEmailBuilder, new oxSimpleXml());
     $oModule1 = oxNew('oxModule');
     $oModule1->setModuleData(array('id' => 'moduleId1', 'version' => '1.0', 'active' => true));
     $oModule2 = oxNew('oxModule');
     $oModule2->setModuleData(array('id' => 'moduleId2', 'version' => '2.0', 'active' => true));
     $oModuleList = $this->getMock('oxModuleList', array('getList'));
     $oModuleList->expects($this->any())->method('getList')->will($this->returnValue(array($oModule1, $oModule2)));
     /** @var oxModule $oModuleList */
     $oOnlineModuleVersionNotifier = new oxOnlineModuleVersionNotifier($oOnlineModuleVersionNotifierCaller, $oModuleList);
     $oOnlineModuleVersionNotifier->versionNotify();
 }