diff --git a/src/Server.php b/src/Server.php index f24499c3..58af2287 100644 --- a/src/Server.php +++ b/src/Server.php @@ -31,6 +31,8 @@ public function __construct(Application $application) $application->register(new SwooleServiceProvider()); parent::__construct($application->getName(), $application->get('config')->get('listen')); + + $this->configure($application->get('config')->get('options')); } /** @@ -41,14 +43,4 @@ public function doRequest(ServerRequest $serverRequest) { return app()->handleRequest($serverRequest); } - - /** - * Please return swoole configuration array. - * - * @return array - */ - public function configure() - { - return app()->get('config')->get('options'); - } } \ No newline at end of file diff --git a/tests/ApplicationTest.php b/tests/ApplicationTest.php index ab7d5aa5..523b4f51 100644 --- a/tests/ApplicationTest.php +++ b/tests/ApplicationTest.php @@ -16,7 +16,7 @@ public function testApplicationInitialize() $app = $this->createApplication(); $this->assertEquals(__DIR__, $app->getAppPath()); - $this->assertEquals('Fast-D', $app->getName()); + $this->assertEquals('fast-d', $app->getName()); $this->assertEquals('PRC', $app['time']->getTimeZone()->getName()); $this->assertTrue($app->isBooted()); } @@ -58,7 +58,7 @@ public function testConfiguration() { $app = $this->createApplication(); - $this->assertEquals('Fast-D', $app->get('config')->get('name')); + $this->assertEquals('fast-d', $app->get('config')->get('name')); } public function testLogger() diff --git a/tests/ServerTest.php b/tests/ServerTest.php index 264a59ac..d9ce9404 100644 --- a/tests/ServerTest.php +++ b/tests/ServerTest.php @@ -27,6 +27,7 @@ public function testServerInit() $server->bootstrap(); $this->assertEquals($server->getSwoole()->setting, [ + 'pid_file' => '', 'worker_num' => 10 ]); } diff --git a/tests/config/server.php b/tests/config/server.php index 25407252..e3761d31 100644 --- a/tests/config/server.php +++ b/tests/config/server.php @@ -9,8 +9,8 @@ return [ 'listen' => 'http://0.0.0.0:9527', - 'pid_file' => '', 'options' => [ + 'pid_file' => '', 'worker_num' => 10 ] ]; \ No newline at end of file