Exemplo n.º 1
0
 public function testReturnSavedInstanceAtStart()
 {
     $stub = $this->getMockBuilder('Ignaszak\\Registry\\Scope\\IRegistry')->disableOriginalConstructor()->setMethods(['test'])->getMock();
     $stub->method('test')->willReturn(true);
     MockTest::injectStatic('Ignaszak\\Registry\\RegistryFactory', 'registryArray', ['request' => $stub]);
     $result = RegistryFactory::start();
     $this->assertTrue($result->test());
 }
Exemplo n.º 2
0
 public function testLoadUserMessageWhenUserIsReporting()
 {
     // Clear counter to call again destructor
     MockTest::injectStatic($this->_controller, 'count');
     MockTest::mockConf('userReporting', E_ALL);
     MockTest::inject($this->_controller, '_logFile', $this->mockLogFile("once"));
     MockTest::inject($this->_controller, '_display', $this->mockDisplay(2));
     $this->_controller->__destruct();
 }
Exemplo n.º 3
0
    public function testLoadLogDisplayWithBacktrace()
    {
        MockTest::injectStatic('Ignaszak\\Exception\\Controller\\IController', 'errorArray', [0 => ['type' => 'Warning', 'message' => 'anyMessage', 'file' => 'anyFile', 'line' => 1, 'trace' => [0 => ['message' => 'backtraceMEssage', 'file' => 'backtraceFile', 'arguments' => 'anyArguments']]]]);
        $result = MockTest::callMockMethod($this->_logFile, 'loadLogDisplay');
        $this->assertEquals(['errors' => <<<EOT
#1 [Warning]
    anyMessage in anyFile on line 1
    [Backtrace]:
        backtraceMEssage
              IN: backtraceFile
              ARGUMENTS:
                  anyArguments


EOT
, 'errorsCount' => 1], $result);
        MockTest::injectStatic('Ignaszak\\Exception\\Controller\\IController', 'errorArray', []);
    }
Exemplo n.º 4
0
 /**
  * Clear mock entity from \Conf\DB\DBDoctrine
  */
 public static function clear()
 {
     MockTest::injectStatic('Conf\\DB\\DBDoctrine', 'em');
 }
Exemplo n.º 5
0
 public function testGetSingleRefererDataByKey()
 {
     $referData = [5, 4, 3, 2, 1];
     MockTest::injectStatic('App\\Resource\\Server', 'readReferDataArray', $referData);
     $this->assertEquals(4, $this->_form->getFormResponseData(1));
 }
Exemplo n.º 6
0
 private function referData(array $data = null)
 {
     MockTest::injectStatic('App\\Resource\\Server', 'readReferDataArray', $data);
 }
Exemplo n.º 7
0
 public function testGetErrorArray()
 {
     MockTest::injectStatic('Ignaszak\\Exception\\Controller\\IController', 'errorArray', array(true));
     $this->assertTrue(MockTest::callMockMethod($this->display, 'getErrorArray')[0]);
 }