/** * 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'); } }
/** * @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); }
function oxNew($className) { return Registry::getInstance()->get(strtolower($className)); }
public static function getUtils() { return Registry::getInstance()->get(strtolower('oxUtils')); }
/** * {@inheritdoc} */ public function endTest(\PHPUnit_Framework_Test $test, $time) { Registry::getInstance()->resetAll(); parent::endTest($test, $time); }
/** * @return \SrUnit\Mock\Registry */ protected function getRegistry() { if (is_null($this->registry)) { $this->registry = Registry::getInstance(); } return $this->registry; }