Exemplo n.º 1
0
 public function setUp()
 {
     Manager::reset();
     $this->logs = array();
     $this->logger = $this->getMock('Psr\\Log\\AbstractLogger', array('log'), array(), '', false);
     $this->logger->expects($this->any())->method('log')->will($this->returnCallback(array($this, 'mockLog')));
 }
Exemplo n.º 2
0
 public function testRegisterResetAndValues()
 {
     $this->assertFalse(Manager::overridden('natcasesort'));
     Manager::register('\\Skeetr\\Tests\\Runtime\\Example');
     $function = new \ReflectionFunction('natcasesort');
     $this->assertFalse($function->isInternal());
     $this->assertSame('foo', natcasesort('foo'));
     $this->assertTrue(Manager::overridden('natcasesort'));
     $this->assertSame(1, Example::$test);
     Example::$test = 0;
     Manager::reset();
     $this->assertSame(1, Example::$test);
     Example::$test = 0;
     Manager::reset('\\Skeetr\\Tests\\Runtime\\Example');
     $this->assertSame(1, Example::$test);
     $this->assertTrue(false === Manager::reset('NotExists'));
     $expected = array('example' => array('test' => 1));
     $this->assertSame($expected, Manager::values('\\Skeetr\\Tests\\Runtime\\Example'));
     $values = Manager::values('\\Skeetr\\Tests\\Runtime\\Example');
     $this->assertSame(1, $values['example']['test']);
 }
Exemplo n.º 3
0
 /**
  * Set the headers and the response code to a given $response, class is reset after.
  *
  * @param  HTTP\Response $response
  * @return boolean
  */
 private function prepareResponse(HTTP\Response $response)
 {
     if (!Manager::loaded()) {
         return false;
     }
     session_write_close();
     $values = Manager::values();
     if (isset($values['header'])) {
         if (isset($values['header']['code']) && $values['header']['code']) {
             $response->setResponseCode($values['header']['code']);
         }
         if (isset($values['header']['list'])) {
             foreach ($values['header']['list'] as $headers) {
                 foreach ($headers as $header) {
                     $response->addHeader($header, false);
                 }
             }
         }
     }
     Manager::reset();
 }