-
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.
- Loading branch information
Showing
12 changed files
with
589 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
language: php | ||
|
||
services: | ||
- postgresql | ||
- mysql | ||
|
||
php: | ||
- 7.2 | ||
- 7.3 | ||
|
||
env: | ||
- DB_TYPE=pgsql | ||
DB_HOST=localhost | ||
DB_NAME=userdevice | ||
DB_PORT=5432 | ||
DB_USERNAME=postgres | ||
DB_PASSWORD=root | ||
- DB_TYPE=mysql | ||
DB_HOST=127.0.0.1 | ||
DB_NAME=userdevice | ||
DB_PORT=3306 | ||
DB_USERNAME=root | ||
DB_PASSWORD= | ||
|
||
before_script: | ||
- travis_retry composer self-update | ||
- travis_retry composer install --no-interaction --prefer-source | ||
- sh -c "if [ '$DB_TYPE' = 'pgsql' ]; then psql -c 'CREATE DATABASE userdevice;' -U postgres; fi" | ||
- sh -c "if [ '$DB_TYPE' = 'mysql' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS userdevice;'; fi" | ||
|
||
script: | ||
- travis_retry composer lint | ||
- travis_retry composer cover | ||
|
||
after_success: | ||
- bash <(curl -s https://codecov.io/bash) |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -13,4 +13,3 @@ | |
</blacklist> | ||
</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,76 @@ | ||
<?php | ||
|
||
namespace Wearesho\Yii\UserDevice\Tests\Mocks; | ||
|
||
use Wearesho\Yii\UserDevice\Behavior; | ||
use yii\web; | ||
|
||
/** | ||
* Class UserMock | ||
* @package Wearesho\Yii\UserDevice\Tests\Mocks | ||
*/ | ||
class UserMock extends web\User implements web\IdentityInterface | ||
{ | ||
public $identityClass = web\User::class; | ||
|
||
public $id; | ||
|
||
public function __construct(int $id, array $config = []) | ||
{ | ||
parent::__construct($config); | ||
$this->id = $id; | ||
} | ||
|
||
public function behaviors() | ||
{ | ||
return [ | ||
'store-device' => [ | ||
'class' => Behavior::class, | ||
'user' => $this, | ||
'request' => \Yii::$app->request, | ||
], | ||
]; | ||
} | ||
|
||
public static function findIdentity($id) | ||
{ | ||
return $id; | ||
} | ||
|
||
/** | ||
* @param mixed $token | ||
* @param null $type | ||
* | ||
* @return void|web\IdentityInterface | ||
* @throws \Exception | ||
*/ | ||
public static function findIdentityByAccessToken($token, $type = null) | ||
{ | ||
throw new \Exception('Method not implemented!'); | ||
} | ||
|
||
public function getId(): int | ||
{ | ||
return $this->id; | ||
} | ||
|
||
/** | ||
* @return string|void | ||
* @throws \Exception | ||
*/ | ||
public function getAuthKey() | ||
{ | ||
throw new \Exception('Method not implemented!'); | ||
} | ||
|
||
/** | ||
* @param string $authKey | ||
* | ||
* @return bool|void | ||
* @throws \Exception | ||
*/ | ||
public function validateAuthKey($authKey) | ||
{ | ||
throw new \Exception('Method not implemented!'); | ||
} | ||
} |
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 | ||
|
||
namespace Wearesho\Yii\UserDevice\Tests; | ||
|
||
use yii\helpers\ArrayHelper; | ||
use yii\phpunit\MigrateFixture; | ||
|
||
/** | ||
* Class TestCase | ||
* @package Wearesho\Yii\UserDevice\Tests | ||
* @internal | ||
*/ | ||
class TestCase extends \yii\phpunit\TestCase | ||
{ | ||
public function globalFixtures(): array | ||
{ | ||
$fixtures = [ | ||
[ | ||
'class' => MigrateFixture::class, | ||
'migrationNamespaces' => [ | ||
'Wearesho\\Yii\\UserDevice\\Migrations', | ||
], | ||
] | ||
]; | ||
|
||
return ArrayHelper::merge(parent::globalFixtures(), $fixtures); | ||
} | ||
} |
Oops, something went wrong.