Skip to content

Commit

Permalink
fixed server
Browse files Browse the repository at this point in the history
  • Loading branch information
JanHuang committed Feb 2, 2017
1 parent 1fe2744 commit 608be58
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
12 changes: 2 additions & 10 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}

/**
Expand All @@ -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');
}
}
4 changes: 2 additions & 2 deletions tests/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions tests/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function testServerInit()
$server->bootstrap();

$this->assertEquals($server->getSwoole()->setting, [
'pid_file' => '',
'worker_num' => 10
]);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/config/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

return [
'listen' => 'http://0.0.0.0:9527',
'pid_file' => '',
'options' => [
'pid_file' => '',
'worker_num' => 10
]
];

0 comments on commit 608be58

Please sign in to comment.