mirror of
https://github.com/yiisoft/yii2.git
synced 2026-03-19 13:48:28 +01:00
Apply fixeds rector.
This commit is contained in:
@@ -24,7 +24,7 @@ class ModuleTest extends TestCase
|
||||
$this->mockApplication();
|
||||
}
|
||||
|
||||
public function testTrueParentModule()
|
||||
public function testTrueParentModule(): void
|
||||
{
|
||||
$parent = new Module('parent');
|
||||
$child = new Module('child');
|
||||
@@ -37,7 +37,7 @@ class ModuleTest extends TestCase
|
||||
$this->assertEquals('parent', $child2->module->id);
|
||||
}
|
||||
|
||||
public function testGetControllerPath()
|
||||
public function testGetControllerPath(): void
|
||||
{
|
||||
$module = new TestModule('test');
|
||||
$controllerPath = __DIR__ . DIRECTORY_SEPARATOR . 'controllers';
|
||||
@@ -46,7 +46,7 @@ class ModuleTest extends TestCase
|
||||
$this->assertEquals($controllerPath, str_replace(['/', '\\'], DIRECTORY_SEPARATOR, $module->getControllerPath()));
|
||||
}
|
||||
|
||||
public function testSetControllerPath()
|
||||
public function testSetControllerPath(): void
|
||||
{
|
||||
$module = new TestModule('test');
|
||||
$controllerPath = __DIR__ . DIRECTORY_SEPARATOR . 'controllers';
|
||||
@@ -55,7 +55,7 @@ class ModuleTest extends TestCase
|
||||
$this->assertEquals($controllerPath, $module->getControllerPath());
|
||||
}
|
||||
|
||||
public function testSetupVersion()
|
||||
public function testSetupVersion(): void
|
||||
{
|
||||
$module = new TestModule('test');
|
||||
|
||||
@@ -63,17 +63,16 @@ class ModuleTest extends TestCase
|
||||
$module->setVersion($version);
|
||||
$this->assertEquals($version, $module->getVersion());
|
||||
|
||||
$module->setVersion(function ($module) {
|
||||
$module->setVersion(fn($module) =>
|
||||
/* @var $module TestModule */
|
||||
return 'version.' . $module->getUniqueId();
|
||||
});
|
||||
'version.' . $module->getUniqueId());
|
||||
$this->assertEquals('version.test', $module->getVersion());
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSetupVersion
|
||||
*/
|
||||
public function testDefaultVersion()
|
||||
public function testDefaultVersion(): void
|
||||
{
|
||||
$module = new TestModule('test');
|
||||
|
||||
@@ -83,7 +82,7 @@ class ModuleTest extends TestCase
|
||||
|
||||
public static $actionRuns = [];
|
||||
|
||||
public function testRunControllerAction()
|
||||
public function testRunControllerAction(): void
|
||||
{
|
||||
$module = new TestModule('test');
|
||||
$this->assertNull(Yii::$app->controller);
|
||||
@@ -112,7 +111,7 @@ class ModuleTest extends TestCase
|
||||
}
|
||||
|
||||
|
||||
public function testServiceLocatorTraversal()
|
||||
public function testServiceLocatorTraversal(): void
|
||||
{
|
||||
$parent = new Module('parent');
|
||||
$child = new Module('child', $parent);
|
||||
@@ -145,7 +144,7 @@ class ModuleTest extends TestCase
|
||||
$this->assertFalse($parent->has('test'));
|
||||
}
|
||||
|
||||
public function testCreateControllerByID()
|
||||
public function testCreateControllerByID(): void
|
||||
{
|
||||
$module = new TestModule('test');
|
||||
$module->controllerNamespace = 'yiiunit\framework\base';
|
||||
@@ -172,7 +171,7 @@ class ModuleTest extends TestCase
|
||||
$this->assertNotInstanceOf(VeryComplexNameTestController::class, $module->createControllerByID($route));
|
||||
}
|
||||
|
||||
public function testCreateController()
|
||||
public function testCreateController(): void
|
||||
{
|
||||
// app module has a submodule "base" which has two controllers: "default" and "other"
|
||||
$module = new Module('app');
|
||||
@@ -184,27 +183,27 @@ class ModuleTest extends TestCase
|
||||
'other' => $otherController,
|
||||
];
|
||||
|
||||
list($controller, $action) = $module->createController('base');
|
||||
[$controller, $action] = $module->createController('base');
|
||||
$this->assertSame('', $action);
|
||||
$this->assertSame('app/base/default', $controller->uniqueId);
|
||||
|
||||
list($controller, $action) = $module->createController('base/default');
|
||||
[$controller, $action] = $module->createController('base/default');
|
||||
$this->assertSame('', $action);
|
||||
$this->assertSame('app/base/default', $controller->uniqueId);
|
||||
|
||||
list($controller, $action) = $module->createController('base/other');
|
||||
[$controller, $action] = $module->createController('base/other');
|
||||
$this->assertSame('', $action);
|
||||
$this->assertSame('app/base/other', $controller->uniqueId);
|
||||
|
||||
list($controller, $action) = $module->createController('base/default/index');
|
||||
[$controller, $action] = $module->createController('base/default/index');
|
||||
$this->assertSame('index', $action);
|
||||
$this->assertSame('app/base/default', $controller->uniqueId);
|
||||
|
||||
list($controller, $action) = $module->createController('base/other/index');
|
||||
[$controller, $action] = $module->createController('base/other/index');
|
||||
$this->assertSame('index', $action);
|
||||
$this->assertSame('app/base/other', $controller->uniqueId);
|
||||
|
||||
list($controller, $action) = $module->createController('base/other/someaction');
|
||||
[$controller, $action] = $module->createController('base/other/someaction');
|
||||
$this->assertSame('someaction', $action);
|
||||
$this->assertSame('app/base/other', $controller->uniqueId);
|
||||
|
||||
@@ -226,11 +225,11 @@ class TestModule extends \yii\base\Module
|
||||
|
||||
class ModuleTestController extends Controller
|
||||
{
|
||||
public function actionTest1()
|
||||
public function actionTest1(): void
|
||||
{
|
||||
ModuleTest::$actionRuns[] = $this->action->uniqueId;
|
||||
}
|
||||
public function actionTest2()
|
||||
public function actionTest2(): void
|
||||
{
|
||||
ModuleTest::$actionRuns[] = $this->action->uniqueId;
|
||||
}
|
||||
@@ -238,7 +237,7 @@ class ModuleTestController extends Controller
|
||||
|
||||
class VeryComplexNameTestController extends Controller
|
||||
{
|
||||
public function actionIndex()
|
||||
public function actionIndex(): void
|
||||
{
|
||||
ModuleTest::$actionRuns[] = $this->action->uniqueId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user