-
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
8 changed files
with
120 additions
and
0 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,40 @@ | ||
language: php | ||
|
||
php: | ||
- 5.4 | ||
- 5.5 | ||
- 5.6 | ||
- 7.0 | ||
- hhvm | ||
- hhvm-nightly | ||
|
||
# run build against hhvm but allow them to fail | ||
# http://docs.travis-ci.com/user/build-configuration/#Rows-That-are-Allowed-To-Fail | ||
matrix: | ||
fast_finish: true | ||
allow_failures: | ||
- php: hhvm | ||
- php: hhvm-nightly | ||
- php: 7.0 | ||
|
||
# faster builds on new travis setup not using sudo | ||
sudo: false | ||
|
||
# cache vendor dirs | ||
cache: | ||
directories: | ||
- vendor | ||
- $HOME/.composer/cache | ||
|
||
install: | ||
- travis_retry composer self-update && composer --version | ||
- travis_retry composer global require "fxp/composer-asset-plugin:1.0.0" | ||
- export PATH="$HOME/.composer/vendor/bin:$PATH" | ||
- travis_retry composer install --prefer-dist --no-interaction | ||
|
||
before_script: | ||
- mysql -e 'CREATE DATABASE yiitest;'; | ||
|
||
script: | ||
- phpunit --verbose $PHPUNIT_FLAGS | ||
|
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,13 @@ | ||
<?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="staticactiverecord"> | ||
<directory>./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace lvl\staticactiverecord\unit; | ||
|
||
class ActiveRecordTest extends \yiiunit\framework\db\ActiveRecordTest | ||
{ | ||
protected function setUp() | ||
{ | ||
static::$params = require(__DIR__ . '/data/config.php'); | ||
parent::setUp(); | ||
} | ||
} |
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,15 @@ | ||
<?php | ||
// ensure we get report on all possible php errors | ||
error_reporting(-1); | ||
|
||
define('YII_ENABLE_ERROR_HANDLER', false); | ||
define('YII_DEBUG', true); | ||
$_SERVER['SCRIPT_NAME'] = '/' . __DIR__; | ||
$_SERVER['SCRIPT_FILENAME'] = __FILE__; | ||
|
||
require_once(__DIR__ . '/../vendor/autoload.php'); | ||
require_once(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); | ||
|
||
Yii::setAlias('@yiiunit', __DIR__ . '/../vendor/yiisoft/yii2-dev/tests/unit'); | ||
|
||
Yii::$classMap['yiiunit\data\ar\ActiveRecord'] = __DIR__ . '/override/ActiveRecord.php'; |
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 @@ | ||
config.local.php |
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,16 @@ | ||
<?php | ||
$config = [ | ||
'databases' => [ | ||
'mysql' => [ | ||
'dsn' => 'mysql:host=127.0.0.1;dbname=yiitest', | ||
'username' => 'travis', | ||
'password' => '', | ||
'fixture' => __DIR__ . '/../../vendor/yiisoft/yii2-dev/tests/unit/data/mysql.sql', | ||
] | ||
], | ||
]; | ||
|
||
if (is_file(__DIR__ . '/config.local.php')) { | ||
include(__DIR__ . '/config.local.php'); | ||
} | ||
return $config; |
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,20 @@ | ||
<?php | ||
|
||
namespace yiiunit\data\ar; | ||
|
||
/** | ||
* This class, combined with the classloader override in bootstrap.php, makes all instances | ||
* of yiiunit\data\ar\ActiveRecord extend from this extension's ActiveRecord version instead | ||
* of the original yii\db\ActiveRecord. | ||
* | ||
* This allows us to run the entire Yii ActiveRecord testsuite without overriding each AR class. | ||
*/ | ||
class ActiveRecord extends \lvl\staticactiverecord\db\ActiveRecord | ||
{ | ||
public static $db; | ||
|
||
public static function getDb() | ||
{ | ||
return self::$db; | ||
} | ||
} |