-
-
Notifications
You must be signed in to change notification settings - Fork 37
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 #129 from bizley/no-yii-autoloader
No autoloader required
- Loading branch information
Showing
11 changed files
with
88 additions
and
4 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
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,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<phpunit bootstrap="./tests/bootstrap-no-autoload.php" | ||
colors="true" | ||
convertErrorsToExceptions="true" | ||
convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" | ||
stopOnFailure="false"> | ||
<testsuites> | ||
<testsuite name="Yii 2 Migration Test Suite (No Yii Autoloader)"> | ||
<directory>./tests</directory> | ||
</testsuite> | ||
</testsuites> | ||
</phpunit> |
File renamed without changes.
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,14 @@ | ||
<?php | ||
|
||
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__ . '/stubs/Yii.php'; | ||
|
||
Yii::setAlias('@bizley/migration', __DIR__ . '/../src/'); | ||
Yii::setAlias('@bizley/tests', __DIR__); |
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,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace bizley\tests\functional; | ||
|
||
use bizley\tests\stubs\MigrationControllerStub; | ||
use Yii; | ||
use yii\base\Exception; | ||
use yii\console\ExitCode; | ||
|
||
/** | ||
* This test should be run separate with phpunit-no-yii-autoload.xml config (bootstrap-no-autoload.php bootstrap) | ||
* to make sure no standard Yii autoloader is registered first. | ||
* @group autoloader | ||
*/ | ||
class NoYiiAutoloaderTest extends DbLoaderTestCase | ||
{ | ||
/** @var string */ | ||
public static $schema = 'sqlite'; | ||
|
||
/** | ||
* @test | ||
* @throws Exception | ||
*/ | ||
public function shouldProvideOwnYiiAutoloader(): void | ||
{ | ||
$controller = new MigrationControllerStub('migration', Yii::$app); | ||
$controller->migrationPath = '@bizley/tests/migrations'; | ||
MigrationControllerStub::$stdout = ''; | ||
MigrationControllerStub::$content = ''; | ||
MigrationControllerStub::$confirmControl = true; | ||
|
||
$this->addBase(); | ||
|
||
self::assertEquals(ExitCode::OK, $controller->runAction('update', ['updater_base'])); | ||
} | ||
} |
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,11 @@ | ||
<?php | ||
|
||
require __DIR__ . '/../../vendor/yiisoft/yii2/BaseYii.php'; | ||
|
||
class Yii extends \yii\BaseYii | ||
{ | ||
} | ||
|
||
// no autoloader | ||
Yii::$classMap = require __DIR__ . '/../../vendor/yiisoft/yii2/classes.php'; | ||
Yii::$container = new yii\di\Container(); |