Example #1
0
 /**
  * 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');
 }
Example #2
0
 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);
 }
Example #3
0
 /**
  * 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);
 }
Example #4
0
 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));
 }
Example #5
0
 /**
  * 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);
 }
Example #6
0
 /**
  * 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();
 }