/**
  * Test getArticlesFiles()
  */
 public function testGetArticleFiles()
 {
     $mock = \SrUnit\Mock\Registry::getInstance()->get('oxArticle');
     $actualValue = $mock->getArticleFiles()->offsetGet(0);
     $expectedValue = 'faked file';
     $this->assertEquals($expectedValue, $actualValue);
 }
 /**
  * Get mock object from registry
  *
  * @param $className
  * @param $aArgs
  * @return mixed
  * @throws SrUnit\Mock\Exception
  */
 protected function _getMockObject($className, $aArgs)
 {
     $mock = \SrUnit\Mock\Registry::getInstance()->get($className);
     if ($mock instanceof \Mockery\MockInterface) {
         return $mock;
     } else {
         throw new \SrUnit\Mock\Exception('Class does not implement \\Mockery\\MockInterface');
     }
 }
Example #3
0
 /**
  * @depends testResettingAllInstances
  */
 public function testInstanceKeysAreReturnedCorrect()
 {
     Registry::getInstance()->set('className1', new \stdClass());
     Registry::getInstance()->set('className2', new \stdClass());
     Registry::getInstance()->set('className3', new \stdClass());
     $expectedKeys = array('classname1', 'classname2', 'classname3');
     $actualKeys = Registry::getInstance()->getKeys();
     $this->assertEquals($expectedKeys, $actualKeys);
 }
Example #4
0
 function oxNew($className)
 {
     return Registry::getInstance()->get(strtolower($className));
 }
Example #5
0
 public static function getUtils()
 {
     return Registry::getInstance()->get(strtolower('oxUtils'));
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 public function endTest(\PHPUnit_Framework_Test $test, $time)
 {
     Registry::getInstance()->resetAll();
     parent::endTest($test, $time);
 }
Example #7
0
 /**
  * @return \SrUnit\Mock\Registry
  */
 protected function getRegistry()
 {
     if (is_null($this->registry)) {
         $this->registry = Registry::getInstance();
     }
     return $this->registry;
 }