-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
99 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,32 @@ | ||
{ | ||
"name": "sizeg/yii2-jwt", | ||
"description": "JWT based on Icobucci", | ||
"type": "yii2-extension", | ||
"keywords": ["yii2", "yii 2", "jwt"], | ||
"authors": [ | ||
{ | ||
"name": "Dmitriy Demin", | ||
"email": "[email protected]", | ||
"homepage": "https://sizeg.tk" | ||
} | ||
], | ||
"require": { | ||
"php": ">=5.5.0", | ||
"lcobucci/jwt": "~3.2.0", | ||
"yiisoft/yii2": "*" | ||
"yiisoft/yii2": "~2.0.0" | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^4.8", | ||
"doctrine/instantiator": "1.0.5", | ||
"phpdocumentor/reflection-docblock": "3.2.2" | ||
"phpunit/phpunit": "^4.8" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"sizeg\\jwt\\": "" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"sizeg\\jwt\\tests\\": "tests/" | ||
} | ||
}, | ||
"repositories": [ | ||
{ | ||
|
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 |
---|---|---|
@@ -1,7 +1,18 @@ | ||
<phpunit bootstrap="./tests/bootstrap.php"> | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<phpunit bootstrap="./tests/bootstrap.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
stopOnFailure="false"> | ||
<testsuites> | ||
<testsuite name="Hello World Test Suite"> | ||
<directory>./tests/</directory> | ||
<testsuite name="Test Suite"> | ||
<directory>./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> | ||
<filter> | ||
<whitelist> | ||
<directory suffix=".php">./</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
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,46 @@ | ||
<?php | ||
|
||
namespace sizeg\jwt\tests; | ||
|
||
use yii\console\Application; | ||
|
||
/** | ||
* Class TestCase | ||
* @author SiZE | ||
*/ | ||
class TestCase extends \PHPUnit_Framework_TestCase | ||
{ | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function setUp() | ||
{ | ||
parent::setUp(); | ||
$this->mockApplication(); | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function tearDown() | ||
{ | ||
$this->destroyApplication(); | ||
parent::tearDown(); | ||
} | ||
|
||
protected function mockApplication() | ||
{ | ||
new Application([ | ||
'id' => 'testapp', | ||
'basePath' => __DIR__, | ||
'vendorPath' => dirname(__DIR__) . '/vendor', | ||
'runtimePath' => __DIR__ . '/runtime', | ||
]); | ||
} | ||
|
||
protected function destroyApplication() | ||
{ | ||
\Yii::$app = null; | ||
} | ||
} |
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 |
---|---|---|
@@ -1,16 +1,7 @@ | ||
<?php | ||
|
||
// ensure we get report on all possible php errors | ||
error_reporting(-1); | ||
|
||
define('YII_ENABLE_ERROR_HANDLER', false); | ||
define('YII_DEBUG', true); | ||
|
||
defined('YII_DEBUG') or define('YII_DEBUG', true); | ||
defined('YII_ENV') or define('YII_ENV', 'test'); | ||
|
||
$_SERVER['SCRIPT_NAME'] = '/' . basename(__FILE__); | ||
$_SERVER['SCRIPT_FILENAME'] = __FILE__; | ||
|
||
require_once(__DIR__ . '/../vendor/autoload.php'); | ||
require_once(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); | ||
|
||
Yii::setAlias('@jwttests', __DIR__); | ||
|
||
require(__DIR__ . '/../vendor/autoload.php'); | ||
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); |