Comments (3)
Cannot reproduce in basic app.
Created a module using:
./yii gii/module --moduleClass 'app\modules\Test\Module' --moduleID test
Edited it to implement BootstrapInterface
and add custom url rules on bootstrap:
<?php
namespace app\modules\Test;
use yii\base\BootstrapInterface;
/**
* test module definition class
*/
class Module extends \yii\base\Module implements BootstrapInterface
{
/**
* {@inheritdoc}
*/
public $controllerNamespace = 'app\modules\Test\controllers';
/**
* {@inheritdoc}
*/
public function init()
{
parent::init();
// custom initialization code goes here
}
public function bootstrap($app)
{
$app->getUrlManager()->addRules([
[
'verb' => 'GET',
'pattern' => '/org/config/incident/severity',
'route' => '/incident/severity-level/index',
],
[
'verb' => 'GET,POST',
'pattern' => '/org/config/incident/severity/new',
'route' => '/incident/severity-level/create',
],
[
'verb' => 'GET,POST',
'pattern' => '/org/config/incident/severity/<id:[0-9]+>/<action:(update|delete)>',
'route' => '/incident/severity-level/<action>',
],
], false);
}
}
Added to config/test.php
:
'bootstrap' => [
'class' => app\modules\Test\Module::class,
],
'modules' => [
'admin' => [
'class' => app\modules\Test\Module::class
],
]
Tests run fine. (both unit tests and full test suites, including functional)
Any more info you can give? Or maybe a minimal reproduction project in a zip?
Edit: tested with current master version
codeception/codeception 5.0.x-dev 2f06902 BDD-style testing framework
codeception/lib-innerbrowser 4.0.0 Parent library for all Codeception framework modules and PhpBrowser
codeception/module-asserts 3.0.0 Codeception module containing various assertions
codeception/module-filesystem 3.0.0 Codeception module for testing local filesystem
codeception/module-yii2 1.1.9 Codeception module for Yii2 framework
codeception/verify 3.0.0 BDD assertion library for PHPUnit
symfony/browser-kit 6.4.x-dev 3f5752f Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically
yiisoft/yii2 dev-master ddf0f87 Yii PHP Framework Version 2
yiisoft/yii2-bootstrap5 dev-master cf7807d The Twitter Bootstrap v5 extension for the Yii framework
yiisoft/yii2-debug 2.1.25 The debugger extension for the Yii framework
yiisoft/yii2-faker dev-master 98e4e4c Fixture generator. The Faker integration for the Yii framework.
yiisoft/yii2-gii 2.2.6 The Gii extension for the Yii framework
yiisoft/yii2-symfonymailer 2.0.4 The SymfonyMailer integration for the Yii framework
from yii2-app-basic.
I cannot reproduce either in basic-app for now, seems I have something else elsewhere. I'm still working on identifying the culprit.
from yii2-app-basic.
Hi,
Thanks!
I should have had added something indeed, my bad :( The issue only occurs if pretty URLs are enabled
'urlManager' => [
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => true,
'rules' => $urls, // Declared rules for the "core" app, without modules
],
Switching enablePrettyUrl
to false solves the issue and allows tests to run.
Commenting out all the rules definition in Module.php also works fine.
I'm running on
codeception/codeception 5.0.11 BDD-style testing framework
codeception/lib-asserts 2.1.0 Assertion methods used by Codeception core and Asserts module
codeception/lib-innerbrowser 3.1.3 Parent library for all Codeception framework modules and PhpBrowser
codeception/lib-web 1.0.2 Library containing files used by module-webdriver and lib-innerbrowser or module-phpbrowser
codeception/module-asserts 3.0.0 Codeception module containing various assertions
codeception/module-db 3.1.0 DB module for Codeception
codeception/module-filesystem 3.0.0 Codeception module for testing local filesystem
codeception/module-yii2 1.1.9 Codeception module for Yii2 framework
codeception/stub 4.1.1 Flexible Stub wrapper for PHPUnit's Mock Builder
codeception/verify 3.0.0 BDD assertion library for PHPUnit
phpunit/php-code-coverage 9.2.29 Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator 3.0.6 FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker 3.1.1 Invoke callables with a timeout
phpunit/php-text-template 2.0.4 Simple template engine.
phpunit/php-timer 5.0.3 Utility class for timing
phpunit/phpunit 9.6.13 The PHP Unit Testing framework.
symfony/browser-kit v6.3.2 Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically
yiisoft/yii2 2.0.49.1 Yii PHP Framework Version 2
yiisoft/yii2-bootstrap4 2.0.11 The Twitter Bootstrap extension for the Yii framework
yiisoft/yii2-bootstrap5 2.0.4 The Twitter Bootstrap v5 extension for the Yii framework
yiisoft/yii2-composer 2.0.10 The composer plugin for Yii extension installer
yiisoft/yii2-debug 2.1.25 The debugger extension for the Yii framework
yiisoft/yii2-faker 2.0.5 Fixture generator. The Faker integration for the Yii framework.
yiisoft/yii2-gii 2.2.6 The Gii extension for the Yii framework
yiisoft/yii2-symfonymailer 3.0.0 The SymfonyMailer integration for the Yii framework
[...]
I'll try to reproduce in a brand new project and share it.
from yii2-app-basic.
Related Issues (20)
- options with alias dose not resolved in function registerLinkTag HOT 1
- Can't update 2amigos/qrcode-library HOT 1
- yii2.0.46 using oci8-could not find driver HOT 4
- Wrong version while installation via composer HOT 4
- Requirement codeception/module-filesystem ^2.0 || ^1.1 conflicts with codeception/codeception 5.0 HOT 3
- ItΒ΄s possible update phpunit/phpunit to 10? HOT 1
- CSS issues with Bootstrap HOT 2
- Cannot Get Working Setup for Running Acceptance Tests according to README HOT 2
- I had the same problem - codeception/module-yii2[1.1.0, ..., 1.1.1] require php >=5.6.0 <8.0 -> your php version (8.2.0) does not satisfy that requirement.
- update github folder link
- update assets folder links
- update commands folder links
- update tests folder links
- update views folder links
- update root folder links
- composer.lock file is in .gitignore HOT 1
- Why is phpunit/phpunit a root requirement?
- How to build projects on top of this repo? HOT 3
- yii\bootstrap5\Navbar collapseOptions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yii2-app-basic.