Beispiel #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')));
 }
Beispiel #2
0
 /**
  * Return a new instance of Response with the headers and response code retuned by
  * Skeetr\Runtime\Manager::value() method
  *
  * @return Response
  */
 public static function fromRuntime()
 {
     $response = new static();
     $values = Manager::values();
     $response->setResponseCode($values['header']['code']);
     $response->setHeaders($values['header']['list'], true);
     return $response;
 }
Beispiel #3
0
 public function testSessionStatus()
 {
     if (!Manager::overridden('session_status')) {
         return false;
     }
     $this->assertSame(PHP_SESSION_NONE, session_status());
     session_start();
     $this->assertSame(PHP_SESSION_ACTIVE, session_status());
 }
Beispiel #4
0
 public function testHeaderRegisterCallback()
 {
     if (!function_exists('header_register_callback')) {
         return true;
     }
     $callback = function () use(&$called) {
         $called = 1;
     };
     header_register_callback($callback);
     $values = Manager::values();
     $this->assertSame($callback, $values['header']['callback']);
 }
Beispiel #5
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();
 }
Beispiel #6
0
 public static function getCall($class, $method)
 {
     return parent::getCall($class, $method);
 }
Beispiel #7
0
<?php

$loader = (require __DIR__ . '/../vendor/autoload.php');
$loader->add('Skeetr\\Tests', __DIR__);
$loader->add('Skeetr\\Mocks', __DIR__);
\Skeetr\Runtime\Manager::auto();
Beispiel #8
0
 public function __construct(Socket $socket)
 {
     $this->socket = $socket;
     //TODO: Optional
     Manager::auto();
 }