From 24d97b99f8a3dd85bac90f9e72c6e206d61d8436 Mon Sep 17 00:00:00 2001 From: Lucas Bartholemy Date: Fri, 17 Jun 2022 17:46:18 +0200 Subject: [PATCH 01/44] Removed Swiftmailer dependency (#264) --- composer.json | 1 - config/test.php | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7db83cfc4..0edbf98d2 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,6 @@ "php": ">=7.4.0", "yiisoft/yii2": "~2.0.14", "yiisoft/yii2-bootstrap4": "~2.0.0", - "yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0", "yiisoft/yii2-symfonymailer": "~2.0.3" }, "require-dev": { diff --git a/config/test.php b/config/test.php index f95bc031e..f2e26ef58 100644 --- a/config/test.php +++ b/config/test.php @@ -17,6 +17,7 @@ 'db' => $db, 'mailer' => [ 'useFileTransport' => true, + 'messageClass' => 'yii\symfonymailer\Message' ], 'assetManager' => [ 'basePath' => __DIR__ . '/../web/assets', From 9d3b84517ad93b228311886e0737b213616bb716 Mon Sep 17 00:00:00 2001 From: Luke English Date: Fri, 17 Jun 2022 17:15:52 +0100 Subject: [PATCH 02/44] Update composer depedencies to be the same as the advanced application (#262) * Compatible with PHP 8.1 and Codeception 5 * Add PHP 8.1 to workflow * PHP 7.4 as a minimum * Updated dependencies Co-authored-by: Luke English --- .gitignore | 3 +++ assets/AppAsset.php | 2 +- codeception.yml | 2 +- composer.json | 16 +++++++++------- config/test.php | 3 +++ config/web.php | 7 +++---- tests/acceptance.suite.yml.example | 2 +- tests/functional.suite.yml | 2 +- tests/unit.suite.yml | 2 +- tests/unit/models/UserTest.php | 2 +- views/layouts/main.php | 8 ++++---- views/site/contact.php | 6 +++--- views/site/login.php | 6 +++--- widgets/Alert.php | 4 ++-- 14 files changed, 36 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index 5bd9be80b..28419e445 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,9 @@ Thumbs.db # composer itself is not needed composer.phar +# composer lock +composer.lock + # Mac DS_Store Files .DS_Store diff --git a/assets/AppAsset.php b/assets/AppAsset.php index 3b950fe7d..732d48efc 100644 --- a/assets/AppAsset.php +++ b/assets/AppAsset.php @@ -26,6 +26,6 @@ class AppAsset extends AssetBundle ]; public $depends = [ 'yii\web\YiiAsset', - 'yii\bootstrap4\BootstrapAsset', + 'yii\bootstrap5\BootstrapAsset' ]; } diff --git a/codeception.yml b/codeception.yml index c8c21690d..dd8febcff 100644 --- a/codeception.yml +++ b/codeception.yml @@ -2,7 +2,7 @@ actor: Tester bootstrap: _bootstrap.php paths: tests: tests - log: tests/_output + output: tests/_output data: tests/_data helpers: tests/_support settings: diff --git a/composer.json b/composer.json index 0edbf98d2..31d1a6db3 100644 --- a/composer.json +++ b/composer.json @@ -15,20 +15,22 @@ "minimum-stability": "dev", "require": { "php": ">=7.4.0", - "yiisoft/yii2": "~2.0.14", - "yiisoft/yii2-bootstrap4": "~2.0.0", + "yiisoft/yii2": "~2.0.45", + "yiisoft/yii2-bootstrap5": "~2.0.2", "yiisoft/yii2-symfonymailer": "~2.0.3" }, "require-dev": { "yiisoft/yii2-debug": "~2.1.0", "yiisoft/yii2-gii": "~2.2.0", "yiisoft/yii2-faker": "~2.0.0", - "codeception/codeception": "^4.0", - "codeception/module-asserts": "^1.0", - "codeception/module-yii2": "^1.0", - "codeception/module-filesystem": "^1.0", + "phpunit/phpunit": "~9.5.0", + "codeception/codeception": "^5.0.0-alpha2 || ^4.0", + "codeception/lib-innerbrowser": "^3.0 || ^1.1", + "codeception/module-asserts": "^3.0 || ^1.1", + "codeception/module-yii2": "dev-codecept5 || ^1.1", + "codeception/module-filesystem": "^3.0 || ^1.1", "codeception/verify": "^2.2", - "symfony/browser-kit": ">=2.7 <=4.2.4" + "symfony/browser-kit": "^6.0 || >=2.7 <=4.2.4" }, "config": { "allow-plugins": { diff --git a/config/test.php b/config/test.php index f2e26ef58..317bc1cb6 100644 --- a/config/test.php +++ b/config/test.php @@ -16,6 +16,9 @@ 'components' => [ 'db' => $db, 'mailer' => [ + 'class' => \yii\symfonymailer\Mailer::class, + 'viewPath' => '@app/mail', + // send all mails to a file by default. 'useFileTransport' => true, 'messageClass' => 'yii\symfonymailer\Message' ], diff --git a/config/web.php b/config/web.php index 25cb0d0a2..8b9dd3f94 100644 --- a/config/web.php +++ b/config/web.php @@ -27,10 +27,9 @@ 'errorAction' => 'site/error', ], 'mailer' => [ - 'class' => 'yii\swiftmailer\Mailer', - // send all mails to a file by default. You have to set - // 'useFileTransport' to false and configure transport - // for the mailer to send real emails. + 'class' => \yii\symfonymailer\Mailer::class, + 'viewPath' => '@app/mail', + // send all mails to a file by default. 'useFileTransport' => true, ], 'log' => [ diff --git a/tests/acceptance.suite.yml.example b/tests/acceptance.suite.yml.example index 7bb4986fd..3821d4fe4 100644 --- a/tests/acceptance.suite.yml.example +++ b/tests/acceptance.suite.yml.example @@ -1,4 +1,4 @@ -class_name: AcceptanceTester +actor: AcceptanceTester modules: enabled: - WebDriver: diff --git a/tests/functional.suite.yml b/tests/functional.suite.yml index 6d6ff7b4d..9d8cf149c 100644 --- a/tests/functional.suite.yml +++ b/tests/functional.suite.yml @@ -6,7 +6,7 @@ # RUN `build` COMMAND AFTER ADDING/REMOVING MODULES. #basic/web/index.php -class_name: FunctionalTester +actor: FunctionalTester modules: enabled: - Filesystem diff --git a/tests/unit.suite.yml b/tests/unit.suite.yml index d2e6622f8..c14e49c37 100644 --- a/tests/unit.suite.yml +++ b/tests/unit.suite.yml @@ -3,7 +3,7 @@ # suite for unit (internal) tests. # RUN `build` COMMAND AFTER ADDING/REMOVING MODULES. -class_name: UnitTester +actor: UnitTester modules: enabled: - Asserts diff --git a/tests/unit/models/UserTest.php b/tests/unit/models/UserTest.php index cd1072593..28986cbbd 100644 --- a/tests/unit/models/UserTest.php +++ b/tests/unit/models/UserTest.php @@ -31,7 +31,7 @@ public function testFindUserByUsername() /** * @depends testFindUserByUsername */ - public function testValidateUser($user) + public function testValidateUser() { $user = User::findByUsername('admin'); verify($user->validateAuthKey('test100key'))->notEmpty(); diff --git a/views/layouts/main.php b/views/layouts/main.php index 67328ca86..8de99c540 100644 --- a/views/layouts/main.php +++ b/views/layouts/main.php @@ -5,10 +5,10 @@ use app\assets\AppAsset; use app\widgets\Alert; -use yii\bootstrap4\Breadcrumbs; -use yii\bootstrap4\Html; -use yii\bootstrap4\Nav; -use yii\bootstrap4\NavBar; +use yii\bootstrap5\Breadcrumbs; +use yii\bootstrap5\Html; +use yii\bootstrap5\Nav; +use yii\bootstrap5\NavBar; AppAsset::register($this); ?> diff --git a/views/site/contact.php b/views/site/contact.php index 4ae25a933..597fabcb2 100644 --- a/views/site/contact.php +++ b/views/site/contact.php @@ -1,11 +1,11 @@ title = 'Contact'; diff --git a/views/site/login.php b/views/site/login.php index c8d495ebe..ebb07d9c3 100644 --- a/views/site/login.php +++ b/views/site/login.php @@ -1,11 +1,11 @@ title = 'Login'; $this->params['breadcrumbs'][] = $this->title; diff --git a/widgets/Alert.php b/widgets/Alert.php index fd2b1955c..1302c1f29 100644 --- a/widgets/Alert.php +++ b/widgets/Alert.php @@ -23,7 +23,7 @@ * @author Kartik Visweswaran * @author Alexander Makarov */ -class Alert extends \yii\bootstrap4\Widget +class Alert extends \yii\bootstrap5\Widget { /** * @var array the alert types configuration for the flash messages. @@ -57,7 +57,7 @@ public function run() $flash = $session->getFlash($type); foreach ((array) $flash as $i => $message) { - echo \yii\bootstrap4\Alert::widget([ + echo \yii\bootstrap5\Alert::widget([ 'body' => $message, 'closeButton' => $this->closeButton, 'options' => array_merge($this->options, [ From 69461fcd871bfbaf00ad6234194ad64a952736d6 Mon Sep 17 00:00:00 2001 From: Luke English Date: Fri, 17 Jun 2022 23:41:05 +0100 Subject: [PATCH 03/44] replace "codeception/codeception": "^5.0.0-alpha2" with "codeception/codeception": "^5.0.0" --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 31d1a6db3..f169290f4 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "yiisoft/yii2-gii": "~2.2.0", "yiisoft/yii2-faker": "~2.0.0", "phpunit/phpunit": "~9.5.0", - "codeception/codeception": "^5.0.0-alpha2 || ^4.0", + "codeception/codeception": "^5.0.0 || ^4.0", "codeception/lib-innerbrowser": "^3.0 || ^1.1", "codeception/module-asserts": "^3.0 || ^1.1", "codeception/module-yii2": "dev-codecept5 || ^1.1", From b306be778d958c6c9d2e527a722bf10c71d3d5ae Mon Sep 17 00:00:00 2001 From: Luke English Date: Tue, 21 Jun 2022 12:34:09 +0100 Subject: [PATCH 04/44] update yii2 codeception module as its now a proper release (1.1.6) --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f169290f4..fae8c1a58 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "codeception/codeception": "^5.0.0 || ^4.0", "codeception/lib-innerbrowser": "^3.0 || ^1.1", "codeception/module-asserts": "^3.0 || ^1.1", - "codeception/module-yii2": "dev-codecept5 || ^1.1", + "codeception/module-yii2": "^1.1", "codeception/module-filesystem": "^3.0 || ^1.1", "codeception/verify": "^2.2", "symfony/browser-kit": "^6.0 || >=2.7 <=4.2.4" From e35ea2e81436c17b5fd2db1d4c626409f47f2f87 Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 19 Aug 2022 00:57:02 +0300 Subject: [PATCH 05/44] Fix #267: Adjust main layout for Bootstrap5 (#268) --- views/layouts/main.php | 56 ++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/views/layouts/main.php b/views/layouts/main.php index 8de99c540..0fa458c5f 100644 --- a/views/layouts/main.php +++ b/views/layouts/main.php @@ -11,28 +11,30 @@ use yii\bootstrap5\NavBar; AppAsset::register($this); + +$this->registerCsrfMetaTags(); +$this->registerMetaTag(['charset' => Yii::$app->charset], 'charset'); +$this->registerMetaTag(['name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, shrink-to-fit=no']); +$this->registerMetaTag(['name' => 'description', 'content' => $this->params['meta_description'] ?? '']); +$this->registerMetaTag(['name' => 'keywords', 'content' => $this->params['meta_keywords'] ?? '']); +$this->registerLinkTag(['rel' => 'icon', 'type' => 'image/x-icon', 'href' => '@web/favicon.ico']); ?> beginPage() ?> - - - registerCsrfMetaTags() ?> <?= Html::encode($this->title) ?> head() ?> beginBody() ?> -
+ -
+
- isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], - ]) ?> + params['breadcrumbs'])): ?> + $this->params['breadcrumbs']]) ?> +
-