/** * Test add log message */ public function testAdd() { $configMock = $this->getMock(\Magelight\Config::class, [], [], '', false); \Magelight\Config::forgeMock($configMock); $configMock->expects($this->any())->method('getConfig')->with('global/log/file', \Magelight\Log::DEFAUL_LOG_FILE)->will($this->returnValue('application.log')); $this->log->expects($this->once())->method('writeMessage')->with($this->matchesRegularExpression("/[\\-\\:\\d]+\\s\\-\\serror/i")); $this->log->add('error'); }
public function setUp() { $this->modulesMock = $this->getMock(\Magelight\Components\Modules::class, [], [], '', false); $this->configMock = $this->getMock(\Magelight\Config::class, [], [], '', false); $this->dbMock = $this->getMock(\Magelight\Db\Mysql\Adapter::class, [], [], '', false); $this->appMock = $this->getMockForAbstractClass(App::class, [], '', false, false, true, ['db']); \Magelight\Components\Modules::forgeMock($this->modulesMock); \Magelight\Config::forgeMock($this->configMock); \Magelight\Db\Mysql\Adapter::forgeMock($this->dbMock); \Magelight\App::forgeMock($this->appMock); }
/** * Set up before test */ public function setUp() { $this->app = $this->getMockForAbstractClass(App::class, [], '', false, false, true, []); $this->modulesMock = $this->getMock(\Magelight\Components\Modules::class, [], [], '', false); $this->configMock = $this->getMock(\Magelight\Config::class, [], [], '', false); $this->routerMock = $this->getMock(\Magelight\Components\Router::class, [], [], '', false); $this->sessionMock = $this->getMock(\Magelight\Http\Session::class, [], [], '', false); $this->translatorMock = $this->getMock(\Magelight\I18n\Translator::class, [], [], '', false); $this->eventManagerMock = $this->getMock(\Magelight\Event\Manager::class, [], [], '', false); \Magelight\Components\Modules::forgeMock($this->modulesMock); \Magelight\Config::forgeMock($this->configMock); \Magelight\Components\Router::forgeMock($this->routerMock); \Magelight\Http\Session::forgeMock($this->sessionMock); \Magelight\I18n\Translator::forgeMock($this->translatorMock); \Magelight\Event\Manager::forgeMock($this->eventManagerMock); }
public function testDateTime() { $configMock = $this->getMock(\Magelight\Config::class, [], [], '', false); $configMock->expects($this->once())->method('getConfig')->with('global/view/date_time_format', 'Y-m-d H:i:s')->will($this->returnValue('Y-m-d H:i:s')); \Magelight\Config::forgeMock($configMock); $date = time(); $expectedDateString = date('Y-m-d H:i:s', $date); $this->assertEquals($expectedDateString, \Magelight\Block::forge()->dateTime($date)); }
/** * Set up before test * * @throws \Magelight\Exception */ public function setUp() { $this->eventManager = \Magelight\Event\Manager::forge(); $this->configMock = $this->getMock(\Magelight\Config::class, [], [], 'ConfigMock', false); \Magelight\Config::forgeMock($this->configMock); }
/** * Set up before test */ public function setUp() { $this->configMock = $this->getMock(\Magelight\Config::class, [], [], '', false); \Magelight\Config::forgeMock($this->configMock); $this->adapterPool = \Magelight\Cache\AdapterPool::getInstance(); }