-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from citrus-framework/fix_command
Command用ゲートウェイ
- Loading branch information
Showing
5 changed files
with
131 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright Copyright 2020, CitrusFramework. All Rights Reserved. | ||
* @author take64 <[email protected]> | ||
* @license http://www.citrus.tk/ | ||
*/ | ||
|
||
namespace Test; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
|
||
/** | ||
* ゲートウェイ処理のテスト | ||
*/ | ||
class GatewayTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
*/ | ||
public function main_command_想定通り() | ||
{ | ||
$result = exec('cd tests; ./command.php --domain=example.com --command=Sample\\\SampleData'); | ||
$this->assertSame('execute!', $result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright Copyright 2020, CitrusGeneration. All Rights Reserved. | ||
* @author take64 <[email protected]> | ||
* @license http://www.citrus.tk/ | ||
*/ | ||
|
||
namespace Test\Sample\Command\Sample; | ||
|
||
use Citrus\Configure\ConfigureException; | ||
use Citrus\Console; | ||
|
||
/** | ||
* Sampleデータコマンド | ||
*/ | ||
class SampleDataCommand extends Console | ||
{ | ||
/** @var array command options */ | ||
protected $options = [ | ||
]; | ||
|
||
|
||
|
||
/** | ||
* {@inheritDoc} | ||
* | ||
* @throws ConfigureException | ||
*/ | ||
public function execute(): void | ||
{ | ||
parent::execute(); | ||
echo 'execute!'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* @copyright Copyright 2020, CitrusFramework. All Rights Reserved. | ||
* @author take64 <[email protected]> | ||
* @license http://www.citrus.tk/ | ||
*/ | ||
|
||
date_default_timezone_set('Asia/Tokyo'); | ||
|
||
require_once '../vendor/autoload.php'; | ||
|
||
use Citrus\Authentication; | ||
use Citrus\Configure\Application; | ||
use Citrus\Database\Connection\ConnectionPool; | ||
use Citrus\Database\DSN; | ||
use Citrus\Gateway; | ||
use Citrus\Logger; | ||
use Citrus\Router; | ||
|
||
$configure_path = dirname(__FILE__).'/citrus-configure.php'; | ||
$configures = include($configure_path); | ||
Application::sharedInstance()->loadConfigures($configures); | ||
Authentication::sharedInstance()->loadConfigures($configures); | ||
Logger::sharedInstance()->loadConfigures($configures); | ||
Router::sharedInstance()->loadConfigures($configures); | ||
|
||
// コネクションプール | ||
ConnectionPool::callConnection(DSN::getInstance()->loadConfigures($configures), true); | ||
|
||
Gateway::main(Gateway::TYPE_COMMAND, $configures); |