Skip to content

Commit

Permalink
fixed phpunit error
Browse files Browse the repository at this point in the history
  • Loading branch information
xujiajun committed Jul 18, 2017
1 parent 525acb7 commit 16dc671
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
3 changes: 1 addition & 2 deletions src/Framework/Event/HttpEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace TastPHP\Framework\Event;

use Psr\Http\Message\ServerRequestInterface;
use Symfony\Component\EventDispatcher\Event;

final class HttpEvent extends Event
Expand All @@ -11,7 +10,7 @@ final class HttpEvent extends Event

protected $response;

public function __construct(ServerRequestInterface $request = null, $response = null)
public function __construct($request = null, $response = null)
{
$this->request = $request;
$this->response = $response;
Expand Down
28 changes: 15 additions & 13 deletions src/Framework/Request/RequestServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,20 @@ public function register()
return Request::createFromGlobals();
});

$this->app->singleton('psr7Factory', function () {
return new DiactorosFactory();
});

$this->app->singleton('httpFoundationFactory', function () {
return new HttpFoundationFactory();
});

$this->app->singleton('Request', function () {
return RequestAdapter::convertPsr7Request(Request::createFromGlobals());
});


if (!$this->app->runningInConsole()) {
$this->app->singleton('psr7Factory', function () {
return new DiactorosFactory();
});

$this->app->singleton('httpFoundationFactory', function () {
return new HttpFoundationFactory();
});

$this->app->singleton('Request', function () {
return RequestAdapter::convertPsr7Request(Request::createFromGlobals());
});
} else {
$this->app['Request'] = $this->app['symfonyRequest'];
}
}
}

0 comments on commit 16dc671

Please sign in to comment.