From 4f8ae448fe77dd5813f675a712a6bf0983d0b095 Mon Sep 17 00:00:00 2001 From: Alexander Kozhevnikov Date: Mon, 27 Mar 2017 18:08:01 +0300 Subject: [PATCH 001/184] Fix remote_config path in codeception.yml (#114) `../tests/codeception.yml` does not exist, using `../codeception.yml` works --- codeception.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codeception.yml b/codeception.yml index 2513bee79..3537e68b1 100644 --- a/codeception.yml +++ b/codeception.yml @@ -19,7 +19,7 @@ modules: # #c3_url: http://localhost:8080/index-test.php/ # enabled: true # #remote: true -# #remote_config: '../tests/codeception.yml' +# #remote_config: '../codeception.yml' # whitelist: # include: # - models/* From 2ac711fa20668aa825bb9e671cef698e753e0e9b Mon Sep 17 00:00:00 2001 From: Nikolay Oleynikov Date: Tue, 11 Apr 2017 15:47:45 +0300 Subject: [PATCH 002/184] Fix incorrect type hints (#115) [skip ci] --- controllers/SiteController.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/controllers/SiteController.php b/controllers/SiteController.php index 36dc9591b..63ae7fe40 100644 --- a/controllers/SiteController.php +++ b/controllers/SiteController.php @@ -5,6 +5,7 @@ use Yii; use yii\filters\AccessControl; use yii\web\Controller; +use yii\web\Response; use yii\filters\VerbFilter; use app\models\LoginForm; use app\models\ContactForm; @@ -66,7 +67,7 @@ public function actionIndex() /** * Login action. * - * @return string + * @return Response|string */ public function actionLogin() { @@ -86,7 +87,7 @@ public function actionLogin() /** * Logout action. * - * @return string + * @return Response */ public function actionLogout() { @@ -98,7 +99,7 @@ public function actionLogout() /** * Displays contact page. * - * @return string + * @return Response|string */ public function actionContact() { From 19b6143f051b404c8d73f4b1328d51064aa19e98 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 19 Apr 2017 02:56:34 +0300 Subject: [PATCH 003/184] Update fxp plugin version --- .travis.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e7e847ee5..c7e45906b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ cache: install: - travis_retry composer self-update && composer --version - - travis_retry composer global require "fxp/composer-asset-plugin:~1.1.1" + - travis_retry composer global require "fxp/composer-asset-plugin:~1.3.1" - travis_retry composer update --dev --prefer-dist --no-interaction # setup application: - | diff --git a/README.md b/README.md index 3bc44a785..80e084a2e 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ at [getcomposer.org](http://getcomposer.org/doc/00-intro.md#installation-nix). You can then install this project template using the following command: ~~~ -php composer.phar global require "fxp/composer-asset-plugin:^1.2.0" +php composer.phar global require "fxp/composer-asset-plugin:^1.3.1" php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic ~~~ From 465c00a8eac7251ca2ae521c682ab6467ce1fe9e Mon Sep 17 00:00:00 2001 From: Andrey Subbota Date: Sun, 28 May 2017 02:21:16 +0400 Subject: [PATCH 004/184] Fixed consistency of db-variable name in config files (#120) --- config/test.php | 4 ++-- config/web.php | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/config/test.php b/config/test.php index a92c2fcde..75201e545 100644 --- a/config/test.php +++ b/config/test.php @@ -1,6 +1,6 @@ dirname(__DIR__), 'language' => 'en-US', 'components' => [ - 'db' => $dbParams, + 'db' => $db, 'mailer' => [ 'useFileTransport' => true, ], diff --git a/config/web.php b/config/web.php index 2bc8561fb..e03d406c7 100644 --- a/config/web.php +++ b/config/web.php @@ -1,6 +1,7 @@ 'basic', @@ -37,7 +38,7 @@ ], ], ], - 'db' => require(__DIR__ . '/db.php'), + 'db' => $db, /* 'urlManager' => [ 'enablePrettyUrl' => true, From 56ea7f969978d75150061886c3d3f8a555a98557 Mon Sep 17 00:00:00 2001 From: Andrey Subbota Date: Sun, 28 May 2017 19:17:09 +0400 Subject: [PATCH 005/184] Fix The "extra.asset-installer-paths" option is deprecated (#121) --- composer.json | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index e31abe055..0d1eec927 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,13 @@ "codeception/specify": "~0.4.3" }, "config": { - "process-timeout": 1800 + "process-timeout": 1800, + "fxp-asset":{ + "installer-paths": { + "npm-asset-library": "vendor/npm", + "bower-asset-library": "vendor/bower" + } + } }, "scripts": { "post-create-project-cmd": [ @@ -48,10 +54,6 @@ "generateCookieValidationKey": [ "config/web.php" ] - }, - "asset-installer-paths": { - "npm-asset-library": "vendor/npm", - "bower-asset-library": "vendor/bower" } } } From 591a3ca78caffc9e381f714da99a093a618d4169 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Mon, 5 Jun 2017 20:32:14 +0200 Subject: [PATCH 006/184] release version 2.0.12 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0d1eec927..11e8221d0 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.5", From 927398596b3e1f5415255c5d3b0d56c62259079e Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Mon, 5 Jun 2017 20:32:36 +0200 Subject: [PATCH 007/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 11e8221d0..0d1eec927 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.5", From fc2ec7dfee9313288171e2fe8a5b80e22c1e1509 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Sat, 17 Jun 2017 17:23:21 +0300 Subject: [PATCH 008/184] Switched to asset-packagist.org --- .travis.yml | 4 ++-- README.md | 3 +-- composer.json | 6 ++++++ config/web.php | 4 ++++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index c7e45906b..e51dde1fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,6 +5,7 @@ php: - 5.5 - 5.6 - 7.0 + - 7.1 # - hhvm # faster builds on new travis setup not using sudo @@ -17,7 +18,6 @@ cache: install: - travis_retry composer self-update && composer --version - - travis_retry composer global require "fxp/composer-asset-plugin:~1.3.1" - travis_retry composer update --dev --prefer-dist --no-interaction # setup application: - | @@ -26,4 +26,4 @@ install: script: - | php -S localhost:8080 -t web > /dev/null 2>&1 & - vendor/bin/codecept run \ No newline at end of file + vendor/bin/codecept run diff --git a/README.md b/README.md index 80e084a2e..12790ad10 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,6 @@ at [getcomposer.org](http://getcomposer.org/doc/00-intro.md#installation-nix). You can then install this project template using the following command: ~~~ -php composer.phar global require "fxp/composer-asset-plugin:^1.3.1" php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic ~~~ @@ -117,7 +116,7 @@ Tests can be executed by running ``` vendor/bin/codecept run -``` +``` The command above will execute unit and functional tests. Unit tests are testing the system components, while functional tests are for testing user interaction. Acceptance tests are disabled by default as they require additional setup since diff --git a/composer.json b/composer.json index 0d1eec927..2358a3578 100644 --- a/composer.json +++ b/composer.json @@ -42,6 +42,12 @@ "yii\\composer\\Installer::postCreateProject" ] }, + "repositories": [ + { + "type": "composer", + "url": "https://asset-packagist.org/" + } + ], "extra": { "yii\\composer\\Installer::postCreateProject": { "setPermission": [ diff --git a/config/web.php b/config/web.php index e03d406c7..22cf8fdaa 100644 --- a/config/web.php +++ b/config/web.php @@ -7,6 +7,10 @@ 'id' => 'basic', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], + 'aliases' => [ + '@bower' => '@vendor/bower-asset', + '@npm' => '@vendor/npm-asset', + ], 'components' => [ 'request' => [ // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation From 90b51ff06a8f01347a9a45a0d39583037af7d461 Mon Sep 17 00:00:00 2001 From: MaximAL Date: Fri, 30 Jun 2017 18:00:32 +0300 Subject: [PATCH 009/184] Schema cache options (for production environment) (#129) [skip ci] --- config/db.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/db.php b/config/db.php index c4c12529c..bc75e616f 100644 --- a/config/db.php +++ b/config/db.php @@ -6,4 +6,9 @@ 'username' => 'root', 'password' => '', 'charset' => 'utf8', + + // Schema cache options (for production environment) + //'enableSchemaCache' => true, + //'schemaCacheDuration' => 60, + //'schemaCache' => 'cache', ]; From 7d0275973457bb49bae235084926f11308d202bb Mon Sep 17 00:00:00 2001 From: Matviy Date: Wed, 19 Jul 2017 14:56:26 +0300 Subject: [PATCH 010/184] Added 'aliases' section to test config file fix #130 (#131) --- config/test.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/config/test.php b/config/test.php index 75201e545..e025a9c44 100644 --- a/config/test.php +++ b/config/test.php @@ -7,7 +7,11 @@ */ return [ 'id' => 'basic-tests', - 'basePath' => dirname(__DIR__), + 'basePath' => dirname(__DIR__), + 'aliases' => [ + '@bower' => '@vendor/bower-asset', + '@npm' => '@vendor/npm-asset', + ], 'language' => 'en-US', 'components' => [ 'db' => $db, From 02cf920ff943279204453b8b5598471542232a15 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 2 Aug 2017 16:05:10 +0300 Subject: [PATCH 011/184] Added logo to readme [skip ci] --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 12790ad10..4e852c8b5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ -Yii 2 Basic Project Template -============================ +

+ + + +

Yii 2 Basic Project Template

+
+

Yii 2 Basic Project Template is a skeleton [Yii 2](http://www.yiiframework.com/) application best for rapidly creating small projects. From 4dc90946e9a652b9bb7fc381c53afc548e7ac5d5 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Mon, 7 Aug 2017 23:46:37 +0300 Subject: [PATCH 012/184] Call `require` as statment. Closes #123 --- config/console.php | 4 ++-- config/test.php | 4 ++-- config/test_db.php | 4 ++-- config/web.php | 4 ++-- tests/bin/yii | 10 +++++----- yii | 6 +++--- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/config/console.php b/config/console.php index 3945d9eb2..6660dd407 100644 --- a/config/console.php +++ b/config/console.php @@ -1,7 +1,7 @@ 'basic-console', diff --git a/config/test.php b/config/test.php index e025a9c44..ff9fc6c57 100644 --- a/config/test.php +++ b/config/test.php @@ -1,6 +1,6 @@ 'basic', diff --git a/tests/bin/yii b/tests/bin/yii index 1e4f2cc1d..4923537fb 100755 --- a/tests/bin/yii +++ b/tests/bin/yii @@ -11,14 +11,14 @@ defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'test'); -require(__DIR__ . '/../../vendor/autoload.php'); -require(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'); +require __DIR__ . '/../../vendor/autoload.php'; +require __DIR__ . '/../../vendor/yiisoft/yii2/Yii.php'; $config = yii\helpers\ArrayHelper::merge( - require(__DIR__ . '/../../config/console.php'), + require __DIR__ . '/../../config/console.php', [ 'components' => [ - 'db' => require(__DIR__ . '/../../config/test_db.php') + 'db' => require __DIR__ . '/../../config/test_db.php' ] ] ); @@ -26,4 +26,4 @@ $config = yii\helpers\ArrayHelper::merge( $application = new yii\console\Application($config); $exitCode = $application->run(); -exit($exitCode); \ No newline at end of file +exit($exitCode); diff --git a/yii b/yii index fc7090f77..2a2e8ede7 100755 --- a/yii +++ b/yii @@ -11,10 +11,10 @@ defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'dev'); -require(__DIR__ . '/vendor/autoload.php'); -require(__DIR__ . '/vendor/yiisoft/yii2/Yii.php'); +require __DIR__ . '/vendor/autoload.php'; +require __DIR__ . '/vendor/yiisoft/yii2/Yii.php'; -$config = require(__DIR__ . '/config/console.php'); +$config = require __DIR__ . '/config/console.php'; $application = new yii\console\Application($config); $exitCode = $application->run(); From 1d51cb3790644fb47b2f87a9ed395a2043a73a12 Mon Sep 17 00:00:00 2001 From: nicdnepr Date: Tue, 8 Aug 2017 13:02:19 +0300 Subject: [PATCH 013/184] Added Alert widget (#134) --- views/layouts/main.php | 2 ++ widgets/Alert.php | 75 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) create mode 100644 widgets/Alert.php diff --git a/views/layouts/main.php b/views/layouts/main.php index d0e3b0eb0..920e60d58 100644 --- a/views/layouts/main.php +++ b/views/layouts/main.php @@ -3,6 +3,7 @@ /* @var $this \yii\web\View */ /* @var $content string */ +use app\widgets\Alert; use yii\helpers\Html; use yii\bootstrap\Nav; use yii\bootstrap\NavBar; @@ -61,6 +62,7 @@ isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], ]) ?> + diff --git a/widgets/Alert.php b/widgets/Alert.php new file mode 100644 index 000000000..b19d04061 --- /dev/null +++ b/widgets/Alert.php @@ -0,0 +1,75 @@ +session->setFlash('error', 'This is the message'); + * Yii::$app->session->setFlash('success', 'This is the message'); + * Yii::$app->session->setFlash('info', 'This is the message'); + * ``` + * + * Multiple messages could be set as follows: + * + * ```php + * Yii::$app->session->setFlash('error', ['Error 1', 'Error 2']); + * ``` + * + * @author Kartik Visweswaran + * @author Alexander Makarov + */ +class Alert extends \yii\bootstrap\Widget +{ + /** + * @var array the alert types configuration for the flash messages. + * This array is setup as $key => $value, where: + * - $key is the name of the session flash variable + * - $value is the bootstrap alert type (i.e. danger, success, info, warning) + */ + public $alertTypes = [ + 'error' => 'alert-danger', + 'danger' => 'alert-danger', + 'success' => 'alert-success', + 'info' => 'alert-info', + 'warning' => 'alert-warning' + ]; + /** + * @var array the options for rendering the close button tag. + */ + public $closeButton = []; + + + public function init() + { + parent::init(); + + $session = Yii::$app->session; + $flashes = $session->getAllFlashes(); + $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; + + foreach ($flashes as $type => $data) { + if (isset($this->alertTypes[$type])) { + $data = (array) $data; + foreach ($data as $i => $message) { + /* initialize css class for each alert box */ + $this->options['class'] = $this->alertTypes[$type] . $appendCss; + + /* assign unique id to each alert box */ + $this->options['id'] = $this->getId() . '-' . $type . '-' . $i; + + echo \yii\bootstrap\Alert::widget([ + 'body' => $message, + 'closeButton' => $this->closeButton, + 'options' => $this->options, + ]); + } + + $session->removeFlash($type); + } + } + } +} From a4e8114f60990b1f4cb4e6c1f8f0774ec52ce1b0 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Wed, 9 Aug 2017 20:58:58 +0300 Subject: [PATCH 014/184] Fixed Alert widget --- widgets/Alert.php | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/widgets/Alert.php b/widgets/Alert.php index b19d04061..cd85bd5ad 100644 --- a/widgets/Alert.php +++ b/widgets/Alert.php @@ -27,8 +27,8 @@ class Alert extends \yii\bootstrap\Widget /** * @var array the alert types configuration for the flash messages. * This array is setup as $key => $value, where: - * - $key is the name of the session flash variable - * - $value is the bootstrap alert type (i.e. danger, success, info, warning) + * - key: the name of the session flash variable + * - value: the bootstrap alert type (i.e. danger, success, info, warning) */ public $alertTypes = [ 'error' => 'alert-danger', @@ -39,37 +39,36 @@ class Alert extends \yii\bootstrap\Widget ]; /** * @var array the options for rendering the close button tag. + * Array will be passed to [[\yii\bootstrap\Alert::closeButton]]. */ public $closeButton = []; - - public function init() + /** + * {@inheritdoc} + */ + public function run() { - parent::init(); - $session = Yii::$app->session; $flashes = $session->getAllFlashes(); - $appendCss = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; + $appendClass = isset($this->options['class']) ? ' ' . $this->options['class'] : ''; - foreach ($flashes as $type => $data) { - if (isset($this->alertTypes[$type])) { - $data = (array) $data; - foreach ($data as $i => $message) { - /* initialize css class for each alert box */ - $this->options['class'] = $this->alertTypes[$type] . $appendCss; - - /* assign unique id to each alert box */ - $this->options['id'] = $this->getId() . '-' . $type . '-' . $i; - - echo \yii\bootstrap\Alert::widget([ - 'body' => $message, - 'closeButton' => $this->closeButton, - 'options' => $this->options, - ]); - } + foreach ($flashes as $type => $flash) { + if (!isset($this->alertTypes[$type])) { + continue; + } - $session->removeFlash($type); + foreach ((array) $flash as $i => $message) { + echo \yii\bootstrap\Alert::widget([ + 'body' => $message, + 'closeButton' => $this->closeButton, + 'options' => array_merge($this->options, [ + 'id' => $this->getId() . '-' . $type . '-' . $i, + 'class' => $this->alertTypes[$type] . $appendClass, + ]), + ]); } + + $session->removeFlash($type); } } } From 1fd8921fbf4c593188d1fad3c40ef17f9e044513 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Wed, 9 Aug 2017 22:07:23 +0300 Subject: [PATCH 015/184] Fixed generateCookieValidationKey --- composer.json | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 2358a3578..7967c5255 100644 --- a/composer.json +++ b/composer.json @@ -38,16 +38,13 @@ } }, "scripts": { + "post-install-cmd": [ + "yii\\composer\\Installer::postInstall" + ], "post-create-project-cmd": [ "yii\\composer\\Installer::postCreateProject" ] }, - "repositories": [ - { - "type": "composer", - "url": "https://asset-packagist.org/" - } - ], "extra": { "yii\\composer\\Installer::postCreateProject": { "setPermission": [ @@ -56,10 +53,22 @@ "web/assets": "0777", "yii": "0755" } - ], + ] + }, + "yii\\composer\\Installer::postInstall": { "generateCookieValidationKey": [ "config/web.php" ] + }, + "asset-installer-paths": { + "npm-asset-library": "vendor/npm", + "bower-asset-library": "vendor/bower" + } + }, + "repositories": [ + { + "type": "composer", + "url": "https://asset-packagist.org/" } - } + ] } From 8e05ff8651212c0e0a68b2b4f6dc3864627190e4 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Wed, 9 Aug 2017 22:14:58 +0300 Subject: [PATCH 016/184] minor --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7967c5255..deef5a246 100644 --- a/composer.json +++ b/composer.json @@ -42,7 +42,8 @@ "yii\\composer\\Installer::postInstall" ], "post-create-project-cmd": [ - "yii\\composer\\Installer::postCreateProject" + "yii\\composer\\Installer::postCreateProject", + "yii\\composer\\Installer::postInstall" ] }, "extra": { From 2f2e2506c68080a60dc3f7d488ba30938aefbbc3 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Wed, 16 Aug 2017 15:17:30 +0300 Subject: [PATCH 017/184] Bump to 2.0.13 From d965cf55ac85eb4372412b1ae65bec723bb3f7ce Mon Sep 17 00:00:00 2001 From: Bulat Damdinov Date: Tue, 12 Sep 2017 17:16:50 +0800 Subject: [PATCH 018/184] Using require as a statement (#140) --- tests/_bootstrap.php | 2 +- web/index-test.php | 6 +++--- web/index.php | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/_bootstrap.php b/tests/_bootstrap.php index 969c089b9..131da42af 100644 --- a/tests/_bootstrap.php +++ b/tests/_bootstrap.php @@ -2,5 +2,5 @@ define('YII_ENV', 'test'); defined('YII_DEBUG') or define('YII_DEBUG', true); -require_once(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); +require_once __DIR__ . '/../vendor/yiisoft/yii2/Yii.php'; require __DIR__ .'/../vendor/autoload.php'; \ No newline at end of file diff --git a/web/index-test.php b/web/index-test.php index 7ecf9d5d5..1ec192f22 100644 --- a/web/index-test.php +++ b/web/index-test.php @@ -8,9 +8,9 @@ defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'test'); -require(__DIR__ . '/../vendor/autoload.php'); -require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); +require __DIR__ . '/../vendor/autoload.php'; +require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php'; -$config = require(__DIR__ . '/../config/test.php'); +$config = require __DIR__ . '/../config/test.php'; (new yii\web\Application($config))->run(); diff --git a/web/index.php b/web/index.php index d1e070a39..02d5e1da9 100644 --- a/web/index.php +++ b/web/index.php @@ -4,9 +4,9 @@ defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'dev'); -require(__DIR__ . '/../vendor/autoload.php'); -require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); +require __DIR__ . '/../vendor/autoload.php'; +require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php'; -$config = require(__DIR__ . '/../config/web.php'); +$config = require __DIR__ . '/../config/web.php'; (new yii\web\Application($config))->run(); From c49a8554e868ba5c875e976bf711a3ced0b28e76 Mon Sep 17 00:00:00 2001 From: Bulat Damdinov Date: Tue, 12 Sep 2017 17:29:58 +0800 Subject: [PATCH 019/184] Minor fixes of test files (#139) [skip ci] --- tests/acceptance/AboutCest.php | 3 ++- tests/acceptance/ContactCest.php | 2 +- tests/acceptance/HomeCest.php | 3 ++- tests/acceptance/LoginCest.php | 3 ++- tests/functional/ContactFormCest.php | 1 + tests/functional/LoginFormCest.php | 1 + tests/unit/models/UserTest.php | 2 ++ 7 files changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/acceptance/AboutCest.php b/tests/acceptance/AboutCest.php index 8c1276e27..8a7be5af1 100644 --- a/tests/acceptance/AboutCest.php +++ b/tests/acceptance/AboutCest.php @@ -1,5 +1,6 @@ Date: Thu, 21 Sep 2017 19:01:41 +0300 Subject: [PATCH 020/184] Used application name instead of string literal in the navbar --- views/layouts/main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/layouts/main.php b/views/layouts/main.php index 920e60d58..34649cf54 100644 --- a/views/layouts/main.php +++ b/views/layouts/main.php @@ -29,7 +29,7 @@
'My Company', + 'brandLabel' => Yii::$app->name, 'brandUrl' => Yii::$app->homeUrl, 'options' => [ 'class' => 'navbar-inverse navbar-fixed-top', From 6bb488de6bac9904d1310cd5e45bc8a0d0df0c95 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Mon, 30 Oct 2017 09:33:22 +0100 Subject: [PATCH 021/184] search for framework path in requirements.php fixes https://github.com/yiisoft/yii2/issues/15041 --- requirements.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/requirements.php b/requirements.php index 5d1973268..356773a3c 100644 --- a/requirements.php +++ b/requirements.php @@ -11,7 +11,22 @@ */ // you may need to adjust this path to the correct Yii framework path -$frameworkPath = dirname(__FILE__) . '/vendor/yiisoft/yii2'; +// uncomment and adjust the following line if Yii is not located at the default path +//$frameworkPath = dirname(__FILE__) . '/vendor/yiisoft/yii2'; + + +if (!isset($frameworkPath)) { + $searchPaths = [ + dirname(__FILE__) . '/vendor/yiisoft/yii2', + dirname(__FILE__) . '/../vendor/yiisoft/yii2', + ]; + foreach($searchPaths as $path) { + if (is_dir($path)) { + $frameworkPath = $path; + break; + } + } +} if (!is_dir($frameworkPath)) { echo '

Error

'; From 1c4072499f3d38e9ee2fbeb8702ad57ab596a604 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Mon, 30 Oct 2017 09:42:15 +0100 Subject: [PATCH 022/184] improved requirements checker error message about framework --- requirements.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/requirements.php b/requirements.php index 356773a3c..91a0fb097 100644 --- a/requirements.php +++ b/requirements.php @@ -28,11 +28,19 @@ } } -if (!is_dir($frameworkPath)) { - echo '

Error

'; - echo '

The path to yii framework seems to be incorrect.

'; - echo '

You need to install Yii framework via composer or adjust the framework path in file ' . basename(__FILE__) . '.

'; - echo '

Please refer to the README on how to install Yii.

'; +if (!isset($frameworkPath) || !is_dir($frameworkPath)) { + $message = "

Error

\n\n" + . "

The path to yii framework seems to be incorrect.

\n" + . '

You need to install Yii framework via composer or adjust the framework path in file ' . basename(__FILE__) . ".

\n" + . '

Please refer to the README on how to install Yii.

\n"; + + if (!empty($_SERVER['argv'])) { + // do not print HTML when used in console mode + echo strip_tags($message); + } else { + echo $message; + } + exit(1); } require_once($frameworkPath . '/requirements/YiiRequirementChecker.php'); From e68b4a8f45cd49f779036657ca1ef41c634aff75 Mon Sep 17 00:00:00 2001 From: Bulat Damdinov Date: Mon, 30 Oct 2017 20:27:54 +0800 Subject: [PATCH 023/184] Fix .bowerrc --- .bowerrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.bowerrc b/.bowerrc index 1669168f2..a39b5b0fb 100644 --- a/.bowerrc +++ b/.bowerrc @@ -1,3 +1,3 @@ { - "directory" : "vendor/bower" + "directory" : "vendor/bower-asset" } From 120d35506e411e575ee07aac900d7394b5b7386c Mon Sep 17 00:00:00 2001 From: Tobias Munk Date: Wed, 1 Nov 2017 00:47:09 +0100 Subject: [PATCH 024/184] Updated asset-plugin options (#145) --- README.md | 5 ++++- composer.json | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4e852c8b5..aec7cfc5e 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,10 @@ http://localhost/basic/web/ ~~~ +**NOTES:** +- If you don not have `git` available on your machine, you can run composer commands with `FXP_ASSET__VCS_DRIVER_OPTIONS='{}' composer [...]` to use the GitHub API instead. + + ### Install from an Archive File Extract the archive file downloaded from [yiiframework.com](http://www.yiiframework.com/download/) to @@ -106,7 +110,6 @@ return [ - Refer to the README in the `tests` directory for information specific to basic application tests. - TESTING ------- diff --git a/composer.json b/composer.json index deef5a246..1b98eb0bc 100644 --- a/composer.json +++ b/composer.json @@ -34,7 +34,12 @@ "installer-paths": { "npm-asset-library": "vendor/npm", "bower-asset-library": "vendor/bower" - } + }, + "vcs-driver-options": { + "github-no-api": true + }, + "git-skip-update": "2 days", + "pattern-skip-version": "(-build|-patch)" } }, "scripts": { From 395e9c7faeba1094084d2308e00b519e9f0f1fd4 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Thu, 2 Nov 2017 21:33:35 +0200 Subject: [PATCH 025/184] Removed fxp/cap as default package installation method --- README.md | 5 ----- composer.json | 17 +---------------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/README.md b/README.md index aec7cfc5e..1caaca9af 100644 --- a/README.md +++ b/README.md @@ -61,11 +61,6 @@ directly under the Web root. http://localhost/basic/web/ ~~~ - -**NOTES:** -- If you don not have `git` available on your machine, you can run composer commands with `FXP_ASSET__VCS_DRIVER_OPTIONS='{}' composer [...]` to use the GitHub API instead. - - ### Install from an Archive File Extract the archive file downloaded from [yiiframework.com](http://www.yiiframework.com/download/) to diff --git a/composer.json b/composer.json index 1b98eb0bc..39af5d6f6 100644 --- a/composer.json +++ b/composer.json @@ -29,18 +29,7 @@ "codeception/specify": "~0.4.3" }, "config": { - "process-timeout": 1800, - "fxp-asset":{ - "installer-paths": { - "npm-asset-library": "vendor/npm", - "bower-asset-library": "vendor/bower" - }, - "vcs-driver-options": { - "github-no-api": true - }, - "git-skip-update": "2 days", - "pattern-skip-version": "(-build|-patch)" - } + "process-timeout": 1800 }, "scripts": { "post-install-cmd": [ @@ -65,10 +54,6 @@ "generateCookieValidationKey": [ "config/web.php" ] - }, - "asset-installer-paths": { - "npm-asset-library": "vendor/npm", - "bower-asset-library": "vendor/bower" } }, "repositories": [ From 92688ab18a56108bfcf32c3d9d4f692c43f72b65 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 3 Nov 2017 01:36:10 +0300 Subject: [PATCH 026/184] Fixed travis tests on PHP 5.5 by installing imagick manually (#148) --- .travis.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.travis.yml b/.travis.yml index e51dde1fb..1b996428c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,6 +19,16 @@ cache: install: - travis_retry composer self-update && composer --version - travis_retry composer update --dev --prefer-dist --no-interaction + # install php extensions + - | + if (php --version | grep -i HipHop > /dev/null); then + echo "Skipping imagick and gmagick tests on HHVM" + else + pear config-set preferred_state beta + printf "\n" | pecl install imagick + # gmagick is not installed on travis currently + #printf "\n" | pecl install gmagick + fi # setup application: - | sed -i "s/'cookieValidationKey' => ''/'cookieValidationKey' => 'testkey'/" config/web.php From 6699ce788aca3d678dae4857788cd34e16f05de0 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 3 Nov 2017 01:38:39 +0300 Subject: [PATCH 027/184] release version 2.0.13 --- assets/AppAsset.php | 2 ++ composer.json | 2 +- widgets/Alert.php | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/assets/AppAsset.php b/assets/AppAsset.php index 0e495a8f8..47932b165 100644 --- a/assets/AppAsset.php +++ b/assets/AppAsset.php @@ -10,6 +10,8 @@ use yii\web\AssetBundle; /** + * Main application asset bundle. + * * @author Qiang Xue * @since 2.0 */ diff --git a/composer.json b/composer.json index 39af5d6f6..ea0991a2f 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.5", diff --git a/widgets/Alert.php b/widgets/Alert.php index cd85bd5ad..ae6c1d85c 100644 --- a/widgets/Alert.php +++ b/widgets/Alert.php @@ -43,6 +43,7 @@ class Alert extends \yii\bootstrap\Widget */ public $closeButton = []; + /** * {@inheritdoc} */ From 217f9230d86580af1cd932caf1d0bc003295a96e Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 3 Nov 2017 01:39:17 +0300 Subject: [PATCH 028/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index ea0991a2f..39af5d6f6 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.5", From 525f988d68c37ef6b04f7083727358183c3baea3 Mon Sep 17 00:00:00 2001 From: Milen Hristov Date: Mon, 6 Nov 2017 10:54:35 +0200 Subject: [PATCH 029/184] since 2.0.13, the class name `Object` is invalid since PHP 7.2, use [[BaseObject]] instead. (#151) --- models/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/User.php b/models/User.php index 250fb3962..768bddd62 100644 --- a/models/User.php +++ b/models/User.php @@ -2,7 +2,7 @@ namespace app\models; -class User extends \yii\base\Object implements \yii\web\IdentityInterface +class User extends \yii\base\BaseObject implements \yii\web\IdentityInterface { public $id; public $username; From 812d8d5178b5edae6084d8e762dc3bff906e76b6 Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Mon, 6 Nov 2017 15:10:58 +0100 Subject: [PATCH 030/184] Update composer.json updated yii2 constraint for #151 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 39af5d6f6..4d3b8db7a 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "minimum-stability": "dev", "require": { "php": ">=5.4.0", - "yiisoft/yii2": "~2.0.5", + "yiisoft/yii2": "~2.0.13", "yiisoft/yii2-bootstrap": "~2.0.0", "yiisoft/yii2-swiftmailer": "~2.0.0" }, From 8882b2b7d8c4dfcfa21fcd2da47937d08923c6de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20P=C3=A9rez?= Date: Mon, 6 Nov 2017 16:36:24 +0100 Subject: [PATCH 031/184] Remove trailing whitespaces in config/test.php (#150) --- config/test.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/config/test.php b/config/test.php index ff9fc6c57..f95bc031e 100644 --- a/config/test.php +++ b/config/test.php @@ -7,18 +7,18 @@ */ return [ 'id' => 'basic-tests', - 'basePath' => dirname(__DIR__), + 'basePath' => dirname(__DIR__), 'aliases' => [ '@bower' => '@vendor/bower-asset', '@npm' => '@vendor/npm-asset', - ], + ], 'language' => 'en-US', 'components' => [ 'db' => $db, 'mailer' => [ 'useFileTransport' => true, ], - 'assetManager' => [ + 'assetManager' => [ 'basePath' => __DIR__ . '/../web/assets', ], 'urlManager' => [ @@ -26,7 +26,7 @@ ], 'user' => [ 'identityClass' => 'app\models\User', - ], + ], 'request' => [ 'cookieValidationKey' => 'test', 'enableCsrfValidation' => false, @@ -36,7 +36,7 @@ 'domain' => 'localhost', ], */ - ], + ], ], 'params' => $params, ]; From 8d04158f16fce4224d9a394594b306037cd5bfb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20P=C3=A9rez?= Date: Tue, 7 Nov 2017 13:29:58 +0100 Subject: [PATCH 032/184] Add @bower and @npm aliases in config/console.php You need them if you add the `yii\apidoc\commands\ApiController` and `GuideController` to your console application command map and you run them inside of your applications console app, as said in the yiisoft/yii2-apidoc 's README.md: https://github.com/yiisoft/yii2-apidoc/blob/master/README.md --- config/console.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/console.php b/config/console.php index 6660dd407..1b8d9475b 100644 --- a/config/console.php +++ b/config/console.php @@ -8,6 +8,10 @@ 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'controllerNamespace' => 'app\commands', + 'aliases' => [ + '@bower' => '@vendor/bower-asset', + '@npm' => '@vendor/npm-asset', + ], 'components' => [ 'cache' => [ 'class' => 'yii\caching\FileCache', From c769bd1b0a5cff76457c3ba0a4f244710e0e261a Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Wed, 8 Nov 2017 09:58:56 +0100 Subject: [PATCH 033/184] make use of 2.0.13 ExitCode class in console command --- commands/HelloController.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/commands/HelloController.php b/commands/HelloController.php index 86ab8b853..7f019cced 100644 --- a/commands/HelloController.php +++ b/commands/HelloController.php @@ -8,6 +8,7 @@ namespace app\commands; use yii\console\Controller; +use yii\console\ExitCode; /** * This command echoes the first argument that you have entered. @@ -26,5 +27,7 @@ class HelloController extends Controller public function actionIndex($message = 'hello world') { echo $message . "\n"; + + return ExitCode::OK; } } From a6bc6e9c8791421abb7f812c26bec4d807dfd1d6 Mon Sep 17 00:00:00 2001 From: Nikola Kovacs Date: Thu, 9 Nov 2017 11:09:30 +0100 Subject: [PATCH 034/184] Disable composer-asset-plugin if it's installed Refs #149 --- composer.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4d3b8db7a..3a5fe7e15 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,10 @@ "codeception/specify": "~0.4.3" }, "config": { - "process-timeout": 1800 + "process-timeout": 1800, + "fxp-asset": { + "enabled": false + } }, "scripts": { "post-install-cmd": [ From fc82ba48d0469aab2fac515020fb308551fa9cce Mon Sep 17 00:00:00 2001 From: Sohel Ahmed Mesaniya Date: Thu, 16 Nov 2017 14:33:46 +0530 Subject: [PATCH 035/184] Set password to empty string when reloading login form (#158) --- controllers/SiteController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/controllers/SiteController.php b/controllers/SiteController.php index 63ae7fe40..1a84f9cfb 100644 --- a/controllers/SiteController.php +++ b/controllers/SiteController.php @@ -79,6 +79,8 @@ public function actionLogin() if ($model->load(Yii::$app->request->post()) && $model->login()) { return $this->goBack(); } + + $model->password = ''; return $this->render('login', [ 'model' => $model, ]); From 33882b152b0738aa519f39f7800ee116a65ea8a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?carlos=20gonz=C3=A1lez?= Date: Tue, 5 Dec 2017 00:06:25 +0100 Subject: [PATCH 036/184] Adapted `yii2-app-advanced` Vagrant setup to basic app (#161) --- .gitignore | 5 +- Vagrantfile | 79 ++++++++++++++++++++++++ vagrant/config/.gitignore | 2 + vagrant/config/vagrant-local-example.yml | 22 +++++++ vagrant/nginx/app.conf | 38 ++++++++++++ vagrant/nginx/log/.gitignore | 3 + vagrant/provision/always-as-root.sh | 18 ++++++ vagrant/provision/once-as-root.sh | 71 +++++++++++++++++++++ vagrant/provision/once-as-vagrant.sh | 31 ++++++++++ 9 files changed, 268 insertions(+), 1 deletion(-) create mode 100644 Vagrantfile create mode 100644 vagrant/config/.gitignore create mode 100644 vagrant/config/vagrant-local-example.yml create mode 100644 vagrant/nginx/app.conf create mode 100644 vagrant/nginx/log/.gitignore create mode 100644 vagrant/provision/always-as-root.sh create mode 100644 vagrant/provision/once-as-root.sh create mode 100644 vagrant/provision/once-as-vagrant.sh diff --git a/.gitignore b/.gitignore index 6084c1da5..5bd9be80b 100644 --- a/.gitignore +++ b/.gitignore @@ -27,4 +27,7 @@ phpunit.phar /phpunit.xml tests/_output/* -tests/_support/_generated \ No newline at end of file +tests/_support/_generated + +#vagrant folder +/.vagrant \ No newline at end of file diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 000000000..163b5c256 --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,79 @@ +require 'yaml' +require 'fileutils' + +required_plugins = %w( vagrant-hostmanager vagrant-vbguest ) +required_plugins.each do |plugin| + exec "vagrant plugin install #{plugin}" unless Vagrant.has_plugin? plugin +end + +domains = { + app: 'yii2basic.dev' +} + +config = { + local: './vagrant/config/vagrant-local.yml', + example: './vagrant/config/vagrant-local.example.yml' +} + +# copy config from example if local config not exists +FileUtils.cp config[:example], config[:local] unless File.exist?(config[:local]) +# read config +options = YAML.load_file config[:local] + +# check github token +if options['github_token'].nil? || options['github_token'].to_s.length != 40 + puts "You must place REAL GitHub token into configuration:\n/yii2-app-basic/vagrant/config/vagrant-local.yml" + exit +end + +# vagrant configurate +Vagrant.configure(2) do |config| + # select the box + config.vm.box = 'bento/ubuntu-16.04' + + # should we ask about box updates? + config.vm.box_check_update = options['box_check_update'] + + config.vm.provider 'virtualbox' do |vb| + # machine cpus count + vb.cpus = options['cpus'] + # machine memory size + vb.memory = options['memory'] + # machine name (for VirtualBox UI) + vb.name = options['machine_name'] + end + + # machine name (for vagrant console) + config.vm.define options['machine_name'] + + # machine name (for guest machine console) + config.vm.hostname = options['machine_name'] + + # network settings + config.vm.network 'private_network', ip: options['ip'] + + # sync: folder 'yii2-app-advanced' (host machine) -> folder '/app' (guest machine) + config.vm.synced_folder './', '/app', owner: 'vagrant', group: 'vagrant' + + # disable folder '/vagrant' (guest machine) + config.vm.synced_folder '.', '/vagrant', disabled: true + + # hosts settings (host machine) + config.vm.provision :hostmanager + config.hostmanager.enabled = true + config.hostmanager.manage_host = true + config.hostmanager.ignore_private_ip = false + config.hostmanager.include_offline = true + config.hostmanager.aliases = domains.values + + # quick fix for failed guest additions installations + # config.vbguest.auto_update = false + + # provisioners + config.vm.provision 'shell', path: './vagrant/provision/once-as-root.sh', args: [options['timezone']] + config.vm.provision 'shell', path: './vagrant/provision/once-as-vagrant.sh', args: [options['github_token']], privileged: false + config.vm.provision 'shell', path: './vagrant/provision/always-as-root.sh', run: 'always' + + # post-install message (vagrant console) + config.vm.post_up_message = "App URL: http://#{domains[:app]}" +end diff --git a/vagrant/config/.gitignore b/vagrant/config/.gitignore new file mode 100644 index 000000000..0685a56ca --- /dev/null +++ b/vagrant/config/.gitignore @@ -0,0 +1,2 @@ +# local configuration +vagrant-local.yml \ No newline at end of file diff --git a/vagrant/config/vagrant-local-example.yml b/vagrant/config/vagrant-local-example.yml new file mode 100644 index 000000000..919aec0e8 --- /dev/null +++ b/vagrant/config/vagrant-local-example.yml @@ -0,0 +1,22 @@ +# Your personal GitHub token +github_token: +# Read more: https://github.com/blog/1509-personal-api-tokens +# You can generate it here: https://github.com/settings/tokens + +# Guest OS timezone +timezone: Europe/London + +# Are we need check box updates for every 'vagrant up'? +box_check_update: false + +# Virtual machine name +machine_name: yii2basic + +# Virtual machine IP +ip: 192.168.83.137 + +# Virtual machine CPU cores number +cpus: 1 + +# Virtual machine RAM +memory: 1024 diff --git a/vagrant/nginx/app.conf b/vagrant/nginx/app.conf new file mode 100644 index 000000000..08ec5bb35 --- /dev/null +++ b/vagrant/nginx/app.conf @@ -0,0 +1,38 @@ +server { + charset utf-8; + client_max_body_size 128M; + sendfile off; + + listen 80; ## listen for ipv4 + #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 + + server_name yii2basic.dev; + root /app/web/; + index index.php; + + access_log /app/vagrant/nginx/log/yii2basic.access.log; + error_log /app/vagrant/nginx/log/yii2basic.error.log; + + location / { + # Redirect everything that isn't a real file to index.php + try_files $uri $uri/ /index.php$is_args$args; + } + + # uncomment to avoid processing of calls to non-existing static files by Yii + #location ~ \.(js|css|png|jpg|gif|swf|ico|pdf|mov|fla|zip|rar)$ { + # try_files $uri =404; + #} + #error_page 404 /404.html; + + location ~ \.php$ { + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + #fastcgi_pass 127.0.0.1:9000; + fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; + try_files $uri =404; + } + + location ~ /\.(ht|svn|git) { + deny all; + } +} diff --git a/vagrant/nginx/log/.gitignore b/vagrant/nginx/log/.gitignore new file mode 100644 index 000000000..c0fbfdd8d --- /dev/null +++ b/vagrant/nginx/log/.gitignore @@ -0,0 +1,3 @@ +#nginx logs +yii2basic.access.log +yii2basic.error.log \ No newline at end of file diff --git a/vagrant/provision/always-as-root.sh b/vagrant/provision/always-as-root.sh new file mode 100644 index 000000000..e5d8e33e1 --- /dev/null +++ b/vagrant/provision/always-as-root.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +#== Bash helpers == + +function info { + echo " " + echo "--> $1" + echo " " +} + +#== Provision script == + +info "Provision-script user: `whoami`" + +info "Restart web-stack" +service php7.0-fpm restart +service nginx restart +service mysql restart \ No newline at end of file diff --git a/vagrant/provision/once-as-root.sh b/vagrant/provision/once-as-root.sh new file mode 100644 index 000000000..12165b1c0 --- /dev/null +++ b/vagrant/provision/once-as-root.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash + +#== Import script args == + +timezone=$(echo "$1") + +#== Bash helpers == + +function info { + echo " " + echo "--> $1" + echo " " +} + +#== Provision script == + +info "Provision-script user: `whoami`" + +export DEBIAN_FRONTEND=noninteractive + +info "Configure timezone" +timedatectl set-timezone ${timezone} --no-ask-password + +info "Prepare root password for MySQL" +debconf-set-selections <<< "mariadb-server-10.0 mysql-server/root_password password \"''\"" +debconf-set-selections <<< "mariadb-server-10.0 mysql-server/root_password_again password \"''\"" +echo "Done!" + +info "Update OS software" +apt-get update +apt-get upgrade -y + +info "Install additional software" +apt-get install -y php7.0-curl php7.0-cli php7.0-intl php7.0-mysqlnd php7.0-gd php7.0-fpm php7.0-mbstring php7.0-xml unzip nginx mariadb-server-10.0 php.xdebug + +info "Configure MySQL" +sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/mariadb.conf.d/50-server.cnf +mysql -uroot <<< "CREATE USER 'root'@'%' IDENTIFIED BY ''" +mysql -uroot <<< "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'" +mysql -uroot <<< "DROP USER 'root'@'localhost'" +mysql -uroot <<< "FLUSH PRIVILEGES" +echo "Done!" + +info "Configure PHP-FPM" +sed -i 's/user = www-data/user = vagrant/g' /etc/php/7.0/fpm/pool.d/www.conf +sed -i 's/group = www-data/group = vagrant/g' /etc/php/7.0/fpm/pool.d/www.conf +sed -i 's/owner = www-data/owner = vagrant/g' /etc/php/7.0/fpm/pool.d/www.conf +cat << EOF > /etc/php/7.0/mods-available/xdebug.ini +zend_extension=xdebug.so +xdebug.remote_enable=1 +xdebug.remote_connect_back=1 +xdebug.remote_port=9000 +xdebug.remote_autostart=1 +EOF +echo "Done!" + +info "Configure NGINX" +sed -i 's/user www-data/user vagrant/g' /etc/nginx/nginx.conf +echo "Done!" + +info "Enabling site configuration" +ln -s /app/vagrant/nginx/app.conf /etc/nginx/sites-enabled/app.conf +echo "Done!" + +info "Initailize databases for MySQL" +mysql -uroot <<< "CREATE DATABASE yii2basic" +mysql -uroot <<< "CREATE DATABASE yii2basic_test" +echo "Done!" + +info "Install composer" +curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ No newline at end of file diff --git a/vagrant/provision/once-as-vagrant.sh b/vagrant/provision/once-as-vagrant.sh new file mode 100644 index 000000000..8da47217c --- /dev/null +++ b/vagrant/provision/once-as-vagrant.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +#== Import script args == + +github_token=$(echo "$1") + +#== Bash helpers == + +function info { + echo " " + echo "--> $1" + echo " " +} + +#== Provision script == + +info "Provision-script user: `whoami`" + +info "Configure composer" +composer config --global github-oauth.github.com ${github_token} +echo "Done!" + +info "Install project dependencies" +cd /app +composer --no-progress --prefer-dist install + +info "Create bash-alias 'app' for vagrant user" +echo 'alias app="cd /app"' | tee /home/vagrant/.bash_aliases + +info "Enabling colorized prompt for guest console" +sed -i "s/#force_color_prompt=yes/force_color_prompt=yes/" /home/vagrant/.bashrc From a31ee4418a396d259dd6429091aa604a6b9ffc18 Mon Sep 17 00:00:00 2001 From: Aleksandar Belic Date: Mon, 11 Dec 2017 16:59:34 +0100 Subject: [PATCH 037/184] Removing unused classes from unit test models. (#162) --- tests/unit/models/ContactFormTest.php | 2 -- tests/unit/models/LoginFormTest.php | 1 - 2 files changed, 3 deletions(-) diff --git a/tests/unit/models/ContactFormTest.php b/tests/unit/models/ContactFormTest.php index 81a67e9cc..384889762 100644 --- a/tests/unit/models/ContactFormTest.php +++ b/tests/unit/models/ContactFormTest.php @@ -2,8 +2,6 @@ namespace tests\models; -use app\models\ContactForm; - class ContactFormTest extends \Codeception\Test\Unit { private $model; diff --git a/tests/unit/models/LoginFormTest.php b/tests/unit/models/LoginFormTest.php index 46190cd05..4a15dc9c5 100644 --- a/tests/unit/models/LoginFormTest.php +++ b/tests/unit/models/LoginFormTest.php @@ -3,7 +3,6 @@ namespace tests\models; use app\models\LoginForm; -use Codeception\Specify; class LoginFormTest extends \Codeception\Test\Unit { From 32939e2b27106fc5ee787101fbec3cb527a42b92 Mon Sep 17 00:00:00 2001 From: MaximAL Date: Tue, 6 Feb 2018 12:26:06 +0300 Subject: [PATCH 038/184] Exit code in PhpDoc (#167) [skip ci] --- commands/HelloController.php | 1 + 1 file changed, 1 insertion(+) diff --git a/commands/HelloController.php b/commands/HelloController.php index 7f019cced..20066c40c 100644 --- a/commands/HelloController.php +++ b/commands/HelloController.php @@ -23,6 +23,7 @@ class HelloController extends Controller /** * This command echoes what you have entered as the message. * @param string $message the message to be echoed. + * @return int Exit code */ public function actionIndex($message = 'hello world') { From 7942ecffeef0d5f74ddd0857a5587af93dfcf552 Mon Sep 17 00:00:00 2001 From: Vladimir Jelovac Date: Tue, 6 Feb 2018 22:05:52 +0100 Subject: [PATCH 039/184] Changes to run vagrant from project root dir (#163) Introduced a variable which represents current vagrantfile directory path. This way we can run vagrant directly from the Yii2 project root and do not need to store vagrant configurations separately. --- Vagrantfile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 163b5c256..5c9e12363 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -10,9 +10,11 @@ domains = { app: 'yii2basic.dev' } +vagrantfile_dir_path = File.dirname(__FILE__) + config = { - local: './vagrant/config/vagrant-local.yml', - example: './vagrant/config/vagrant-local.example.yml' + local: vagrantfile_dir_path + '/vagrant/config/vagrant-local.yml', + example: vagrantfile_dir_path + '/vagrant/config/vagrant-local.example.yml' } # copy config from example if local config not exists From cfe16a52d7d1cb71f95d093802e6797099126f41 Mon Sep 17 00:00:00 2001 From: Tobias Munk Date: Tue, 6 Feb 2018 22:07:24 +0100 Subject: [PATCH 040/184] Feature/docker support (#157) * added Docker support * updated Docker docs --- README.md | 23 +++++++++++++++++++++++ docker-compose.yml | 9 +++++++++ 2 files changed, 32 insertions(+) create mode 100644 docker-compose.yml diff --git a/README.md b/README.md index 1caaca9af..d3dc4b70c 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,29 @@ http://localhost/basic/web/ ~~~ +### Install with Docker + +Update your vendor packages + + docker-compose run --rm php composer update --prefer-dist + +Run the installation triggers (creating cookie validation code) + + docker-compose run --rm php composer install + +Start the container + + docker-compose up -d + +You can then access the application through the following URL: + + http://127.0.0.1:8000 + +**NOTES:** +- Minimum required Docker engine version `17.04` for development (see [Performance tuning for volume mounts](https://docs.docker.com/docker-for-mac/osxfs-caching/)) +- The default configuration uses a host-volume in your home directory `.docker-composer` for composer caches + + CONFIGURATION ------------- diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..c3800ff53 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +version: '2' +services: + php: + image: yiisoftware/yii2-php:7.1-apache + volumes: + - ~/.composer-docker/cache:/root/.composer/cache:delegated + - ./:/app:delegated + ports: + - '8000:80' \ No newline at end of file From cb49ebde2ab353d8cdc83943bf54488bed51a903 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 17 Feb 2018 22:15:06 +0300 Subject: [PATCH 041/184] Fixes #165: Fixed example file name --- .../{vagrant-local-example.yml => vagrant-local.example.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename vagrant/config/{vagrant-local-example.yml => vagrant-local.example.yml} (100%) diff --git a/vagrant/config/vagrant-local-example.yml b/vagrant/config/vagrant-local.example.yml similarity index 100% rename from vagrant/config/vagrant-local-example.yml rename to vagrant/config/vagrant-local.example.yml From b5fb6dc7bc7ffa9778c8e166cd2ebe4e96b4649a Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sun, 18 Feb 2018 23:48:18 +0300 Subject: [PATCH 042/184] Updated badges --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d3dc4b70c..6acc916b2 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,8 @@ The template contains the basic features including user login/logout and a conta It includes all commonly used configurations that would allow you to focus on adding new features to your application. -[![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-app-basic/v/stable.png)](https://packagist.org/packages/yiisoft/yii2-app-basic) -[![Total Downloads](https://poser.pugx.org/yiisoft/yii2-app-basic/downloads.png)](https://packagist.org/packages/yiisoft/yii2-app-basic) +[![Latest Stable Version](https://img.shields.io/packagist/v/yiisoft/yii2-app-basic.svg)](https://packagist.org/packages/yiisoft/yii2-app-basic) +[![Total Downloads](https://img.shields.io/packagist/dt/yiisoft/yii2-app-basic.svg)](https://packagist.org/packages/yiisoft/yii2-app-basic) [![Build Status](https://travis-ci.org/yiisoft/yii2-app-basic.svg?branch=master)](https://travis-ci.org/yiisoft/yii2-app-basic) DIRECTORY STRUCTURE From 24ed409e71a87733af2e6db05f24ea6cdfbbdecb Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Mon, 19 Feb 2018 00:29:21 +0200 Subject: [PATCH 043/184] Minor --- controllers/SiteController.php | 4 ++-- models/User.php | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/controllers/SiteController.php b/controllers/SiteController.php index 1a84f9cfb..6e8a85d10 100644 --- a/controllers/SiteController.php +++ b/controllers/SiteController.php @@ -13,7 +13,7 @@ class SiteController extends Controller { /** - * @inheritdoc + * {@inheritdoc} */ public function behaviors() { @@ -39,7 +39,7 @@ public function behaviors() } /** - * @inheritdoc + * {@inheritdoc} */ public function actions() { diff --git a/models/User.php b/models/User.php index 768bddd62..2e3fb25ed 100644 --- a/models/User.php +++ b/models/User.php @@ -29,7 +29,7 @@ class User extends \yii\base\BaseObject implements \yii\web\IdentityInterface /** - * @inheritdoc + * {@inheritdoc} */ public static function findIdentity($id) { @@ -37,7 +37,7 @@ public static function findIdentity($id) } /** - * @inheritdoc + * {@inheritdoc} */ public static function findIdentityByAccessToken($token, $type = null) { @@ -68,7 +68,7 @@ public static function findByUsername($username) } /** - * @inheritdoc + * {@inheritdoc} */ public function getId() { @@ -76,7 +76,7 @@ public function getId() } /** - * @inheritdoc + * {@inheritdoc} */ public function getAuthKey() { @@ -84,7 +84,7 @@ public function getAuthKey() } /** - * @inheritdoc + * {@inheritdoc} */ public function validateAuthKey($authKey) { From dfd0a02b50e0dd96051051bde9251258bda3fd68 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Mon, 19 Feb 2018 00:35:59 +0200 Subject: [PATCH 044/184] release version 2.0.14 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 3a5fe7e15..e4a915c7d 100644 --- a/composer.json +++ b/composer.json @@ -12,10 +12,10 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.4.0", - "yiisoft/yii2": "~2.0.13", + "yiisoft/yii2": "~2.0.14", "yiisoft/yii2-bootstrap": "~2.0.0", "yiisoft/yii2-swiftmailer": "~2.0.0" }, From 9245d033e4c1cc41aa1beabcd4564af497535ad0 Mon Sep 17 00:00:00 2001 From: SilverFire - Dmitry Naumenko Date: Mon, 19 Feb 2018 00:36:21 +0200 Subject: [PATCH 045/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index e4a915c7d..119d8d594 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", From dafe5f6afff00ca4990c1aeda6a1d78512f565eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20P=C3=A9rez?= Date: Fri, 23 Feb 2018 18:57:48 +0100 Subject: [PATCH 046/184] Set `@tests` alias by default (#169) --- config/console.php | 1 + 1 file changed, 1 insertion(+) diff --git a/config/console.php b/config/console.php index 1b8d9475b..299656afc 100644 --- a/config/console.php +++ b/config/console.php @@ -11,6 +11,7 @@ 'aliases' => [ '@bower' => '@vendor/bower-asset', '@npm' => '@vendor/npm-asset', + '@tests' => '@app/tests', ], 'components' => [ 'cache' => [ From 561b98a03943d61efece28a648142e3ac3d9596c Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 15 Mar 2018 01:17:30 +0300 Subject: [PATCH 047/184] Register meta tags with a method that works well with page cache --- views/layouts/main.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/layouts/main.php b/views/layouts/main.php index 34649cf54..87dfdcbc9 100644 --- a/views/layouts/main.php +++ b/views/layouts/main.php @@ -19,7 +19,7 @@ - + registerCsrfMetaTags() ?> <?= Html::encode($this->title) ?> head() ?> From 0b94c3142b5070b44fa389be74ff2191a783af10 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Sun, 1 Apr 2018 04:54:23 -0500 Subject: [PATCH 048/184] Partially Fixes #177 Nginx default config interferes with dev domain. Still causes an issue with SSL redirect. (#178) --- vagrant/provision/once-as-root.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/vagrant/provision/once-as-root.sh b/vagrant/provision/once-as-root.sh index 12165b1c0..311d77b4c 100644 --- a/vagrant/provision/once-as-root.sh +++ b/vagrant/provision/once-as-root.sh @@ -62,6 +62,10 @@ info "Enabling site configuration" ln -s /app/vagrant/nginx/app.conf /etc/nginx/sites-enabled/app.conf echo "Done!" +info "Removing default site configuration" +rm /etc/nginx/sites-enabled/default +echo "Done!" + info "Initailize databases for MySQL" mysql -uroot <<< "CREATE DATABASE yii2basic" mysql -uroot <<< "CREATE DATABASE yii2basic_test" From e3ab8489a59a017b2fced952063415e26995b80d Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 26 Apr 2018 21:08:54 +0300 Subject: [PATCH 049/184] Removed redundant line from license [skip ci] --- LICENSE.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index e98f03df8..ee872b9ab 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,3 @@ -The Yii framework is free software. It is released under the terms of -the following BSD License. - Copyright © 2008 by Yii Software LLC (http://www.yiisoft.com) All rights reserved. From 56bac0cffdfd7a17d30eed94c4053baa1b8ffa42 Mon Sep 17 00:00:00 2001 From: Maarten van Middelaar Date: Wed, 23 May 2018 23:53:00 +0200 Subject: [PATCH 050/184] Add fixtures in Yii2 module (#182) To be able to follow the instruction on https://www.yiiframework.com/doc/guide/2.0/en/test-fixtures `$I->grabFixture()` we need to enable the fixtures feature of the Yii2. Methinks this would be a good thing to enable by default. --- tests/unit.suite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit.suite.yml b/tests/unit.suite.yml index b1efaba99..d2e6622f8 100644 --- a/tests/unit.suite.yml +++ b/tests/unit.suite.yml @@ -8,4 +8,4 @@ modules: enabled: - Asserts - Yii2: - part: [orm, email] \ No newline at end of file + part: [orm, email, fixtures] From d355029d028708218757d3f239072af261d407c2 Mon Sep 17 00:00:00 2001 From: Maarten van Middelaar Date: Thu, 14 Jun 2018 01:11:36 +0200 Subject: [PATCH 051/184] Remove setting cleanup false (#183) It is not clear why cleanup is set to false in the template. ActiveFixture fixture data is not loaded when a previous test had fixtures. --- codeception.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/codeception.yml b/codeception.yml index 3537e68b1..a95affe04 100644 --- a/codeception.yml +++ b/codeception.yml @@ -12,7 +12,6 @@ modules: config: Yii2: configFile: 'config/test.php' - cleanup: false # To enable code coverage: #coverage: From a0095a0bee542763c4c39fb273c407b03595d466 Mon Sep 17 00:00:00 2001 From: Nils Date: Wed, 10 Oct 2018 20:06:02 +0200 Subject: [PATCH 052/184] changed vagrant top-level domain to .test (#188) --- Vagrantfile | 2 +- vagrant/nginx/app.conf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 5c9e12363..44fd76c6d 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -7,7 +7,7 @@ required_plugins.each do |plugin| end domains = { - app: 'yii2basic.dev' + app: 'yii2basic.test' } vagrantfile_dir_path = File.dirname(__FILE__) diff --git a/vagrant/nginx/app.conf b/vagrant/nginx/app.conf index 08ec5bb35..b22e66106 100644 --- a/vagrant/nginx/app.conf +++ b/vagrant/nginx/app.conf @@ -6,7 +6,7 @@ server { listen 80; ## listen for ipv4 #listen [::]:80 default_server ipv6only=on; ## listen for ipv6 - server_name yii2basic.dev; + server_name yii2basic.test; root /app/web/; index index.php; From cfe07e705d3271bf1c30fcfdad35719fa8e44c0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20P=C3=A9rez?= Date: Tue, 4 Dec 2018 20:05:40 +0100 Subject: [PATCH 053/184] Bump codeception/specify, codeception/verify versions (#173) --- composer.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 119d8d594..aca991929 100644 --- a/composer.json +++ b/composer.json @@ -24,9 +24,9 @@ "yiisoft/yii2-gii": "~2.0.0", "yiisoft/yii2-faker": "~2.0.0", - "codeception/base": "^2.2.3", - "codeception/verify": "~0.3.1", - "codeception/specify": "~0.4.3" + "codeception/base": "~2.3.0", + "codeception/verify": "~0.4.0", + "codeception/specify": "~0.4.6" }, "config": { "process-timeout": 1800, From 72af82e3e17232fd2ccda2ceb6ce35315bd1963c Mon Sep 17 00:00:00 2001 From: Matteo Giaccone Date: Wed, 5 Dec 2018 18:15:52 +0100 Subject: [PATCH 054/184] Add MySQL to Travis (#190) --- .travis.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.travis.yml b/.travis.yml index 1b996428c..18e63d91a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,12 @@ cache: directories: - $HOME/.composer/cache +services: + - mysql + +before_install: + - mysql -e 'CREATE DATABASE IF NOT EXISTS yii2_basic_tests;' + install: - travis_retry composer self-update && composer --version - travis_retry composer update --dev --prefer-dist --no-interaction From 069ec1f6d04635303b161c95084353d33873a503 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ricardo=20P=C3=A9rez?= Date: Sun, 27 Jan 2019 21:30:35 +0100 Subject: [PATCH 055/184] Fix namespaces in unit tests (#171) --- tests/unit/models/ContactFormTest.php | 2 +- tests/unit/models/LoginFormTest.php | 2 +- tests/unit/models/UserTest.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/unit/models/ContactFormTest.php b/tests/unit/models/ContactFormTest.php index 384889762..86bbc2c68 100644 --- a/tests/unit/models/ContactFormTest.php +++ b/tests/unit/models/ContactFormTest.php @@ -1,6 +1,6 @@ Date: Thu, 31 Jan 2019 01:00:58 +0100 Subject: [PATCH 056/184] release version 2.0.16 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index aca991929..01a92280d 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", From 603f13964b875ac98406845467fc0ecfc592d11b Mon Sep 17 00:00:00 2001 From: Carsten Brandt Date: Thu, 31 Jan 2019 01:01:20 +0100 Subject: [PATCH 057/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 01a92280d..aca991929 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", From 36365e5aa7e80f01634ddba3b56c2db3f76680f3 Mon Sep 17 00:00:00 2001 From: MaximAL Date: Wed, 6 Mar 2019 20:01:30 +0300 Subject: [PATCH 058/184] Make requirements checker return error if there were failed checks (#196) --- requirements.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/requirements.php b/requirements.php index 91a0fb097..ac16b8b59 100644 --- a/requirements.php +++ b/requirements.php @@ -157,4 +157,6 @@ ); } -$requirementsChecker->checkYii()->check($requirements)->render(); +$result = $requirementsChecker->checkYii()->check($requirements)->getResult(); +$requirementsChecker->render(); +exit($result['summary']['errors'] === 0 ? 0 : 1); From 3479193c9bdc65fd9b5f885f25c58501568ae43b Mon Sep 17 00:00:00 2001 From: Craig London Date: Fri, 22 Mar 2019 11:23:34 -0400 Subject: [PATCH 059/184] master: Update composer.json to use Yii2 Debug & Gii v2.1.0 (#199) --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index aca991929..f44680cb0 100644 --- a/composer.json +++ b/composer.json @@ -20,8 +20,8 @@ "yiisoft/yii2-swiftmailer": "~2.0.0" }, "require-dev": { - "yiisoft/yii2-debug": "~2.0.0", - "yiisoft/yii2-gii": "~2.0.0", + "yiisoft/yii2-debug": "~2.1.0", + "yiisoft/yii2-gii": "~2.1.0", "yiisoft/yii2-faker": "~2.0.0", "codeception/base": "~2.3.0", From 8dc97321341ea33b41a42a5ec5223adf6d42c5bd Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 22 Mar 2019 23:44:48 +0300 Subject: [PATCH 060/184] Fixes #198: Updated dependencies to make sure codeception tests pass right after install --- composer.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index f44680cb0..14137230e 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", "yiisoft/yii2-bootstrap": "~2.0.0", - "yiisoft/yii2-swiftmailer": "~2.0.0" + "yiisoft/yii2-swiftmailer": "~2.1.0" }, "require-dev": { "yiisoft/yii2-debug": "~2.1.0", @@ -26,7 +26,8 @@ "codeception/base": "~2.3.0", "codeception/verify": "~0.4.0", - "codeception/specify": "~0.4.6" + "codeception/specify": "~0.4.6", + "symfony/browser-kit": ">=2.7 <=4.2.4" }, "config": { "process-timeout": 1800, From e063a26253dd7b52c82260c230596df6ddecea32 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 23 Mar 2019 00:40:51 +0300 Subject: [PATCH 061/184] release version 2.0.17 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 14137230e..8a49bc6e1 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", From 87ef32903582796859df324f3b432b9f05d768f8 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 23 Mar 2019 00:41:15 +0300 Subject: [PATCH 062/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8a49bc6e1..14137230e 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", From cb46def3bfd2a1f9afce67d403fb8255d388cd9d Mon Sep 17 00:00:00 2001 From: MaximAL Date: Sun, 24 Mar 2019 16:32:05 +0300 Subject: [PATCH 063/184] Old array syntax in requirement checker (could be run in PHP prior to 5.4) (#201) --- requirements.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements.php b/requirements.php index ac16b8b59..73e04dd0b 100644 --- a/requirements.php +++ b/requirements.php @@ -16,10 +16,10 @@ if (!isset($frameworkPath)) { - $searchPaths = [ + $searchPaths = array( dirname(__FILE__) . '/vendor/yiisoft/yii2', dirname(__FILE__) . '/../vendor/yiisoft/yii2', - ]; + ); foreach($searchPaths as $path) { if (is_dir($path)) { $frameworkPath = $path; From 6dd4e00ce73d573481c1e0eed96afca7b6fb5834 Mon Sep 17 00:00:00 2001 From: MaximAL Date: Sun, 24 Mar 2019 16:33:18 +0300 Subject: [PATCH 064/184] Codestyle: space after `foreach` keyword (#200) --- requirements.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.php b/requirements.php index 73e04dd0b..6cf322eb0 100644 --- a/requirements.php +++ b/requirements.php @@ -20,7 +20,7 @@ dirname(__FILE__) . '/vendor/yiisoft/yii2', dirname(__FILE__) . '/../vendor/yiisoft/yii2', ); - foreach($searchPaths as $path) { + foreach ($searchPaths as $path) { if (is_dir($path)) { $frameworkPath = $path; break; From 4a41e3f53da8639a6814fab1b1d098f2e388b2fa Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 23 Apr 2019 15:02:20 +0300 Subject: [PATCH 065/184] Fixes #204: Allow using older swiftmailer dependency --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 14137230e..c67bc93af 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", "yiisoft/yii2-bootstrap": "~2.0.0", - "yiisoft/yii2-swiftmailer": "~2.1.0" + "yiisoft/yii2-swiftmailer": "~2.1.0|~2.0.7" }, "require-dev": { "yiisoft/yii2-debug": "~2.1.0", From b4b51a3fb9325bdcc8aadeeba21577a7b40043e0 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 23 Apr 2019 15:06:04 +0300 Subject: [PATCH 066/184] Fixed composer.json syntax --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index c67bc93af..8ffc76db4 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", "yiisoft/yii2-bootstrap": "~2.0.0", - "yiisoft/yii2-swiftmailer": "~2.1.0|~2.0.7" + "yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0" }, "require-dev": { "yiisoft/yii2-debug": "~2.1.0", From e38c34a9357c56fe8b83d1ef33578c06e556e14f Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 23 Apr 2019 15:11:10 +0300 Subject: [PATCH 067/184] Adjusted email headers in contact form See https://github.com/yiisoft/yii2-app-advanced/issues/426 --- config/params.php | 2 ++ models/ContactForm.php | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config/params.php b/config/params.php index 6ebf2792b..981c621ac 100644 --- a/config/params.php +++ b/config/params.php @@ -2,4 +2,6 @@ return [ 'adminEmail' => 'admin@example.com', + 'senderEmail' => 'noreply@example.com', + 'senderName' => 'Example.com mailer', ]; diff --git a/models/ContactForm.php b/models/ContactForm.php index 0b13cb05d..f001d2192 100644 --- a/models/ContactForm.php +++ b/models/ContactForm.php @@ -52,7 +52,8 @@ public function contact($email) if ($this->validate()) { Yii::$app->mailer->compose() ->setTo($email) - ->setFrom([$this->email => $this->name]) + ->setFrom([Yii::$app->params['senderEmail'] => Yii::$app->params['senderName']]) + ->setReplyTo([$this->email => $this->name]) ->setSubject($this->subject) ->setTextBody($this->body) ->send(); From 3076318d059157b3d8656235c43d95b65c61444e Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 23 Apr 2019 15:31:43 +0300 Subject: [PATCH 068/184] Fixed contact form tests --- tests/unit/models/ContactFormTest.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/unit/models/ContactFormTest.php b/tests/unit/models/ContactFormTest.php index 86bbc2c68..031d2bd4f 100644 --- a/tests/unit/models/ContactFormTest.php +++ b/tests/unit/models/ContactFormTest.php @@ -2,6 +2,9 @@ namespace tests\unit\models; +use app\models\ContactForm; +use yii\mail\MessageInterface; + class ContactFormTest extends \Codeception\Test\Unit { private $model; @@ -19,7 +22,7 @@ public function testEmailIsSentOnContact() $this->model->expects($this->once()) ->method('validate') - ->will($this->returnValue(true)); + ->willReturn(true); $this->model->attributes = [ 'name' => 'Tester', @@ -33,10 +36,12 @@ public function testEmailIsSentOnContact() // using Yii2 module actions to check email was sent $this->tester->seeEmailIsSent(); + /** @var MessageInterface $emailMessage */ $emailMessage = $this->tester->grabLastSentEmail(); expect('valid email is sent', $emailMessage)->isInstanceOf('yii\mail\MessageInterface'); expect($emailMessage->getTo())->hasKey('admin@example.com'); - expect($emailMessage->getFrom())->hasKey('tester@example.com'); + expect($emailMessage->getFrom())->hasKey('noreply@example.com'); + expect($emailMessage->getReplyTo())->hasKey('tester@example.com'); expect($emailMessage->getSubject())->equals('very important letter subject'); expect($emailMessage->toString())->contains('body of current message'); } From 03697217bc9c231344796ee0b9f1cb95bf948d8b Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 23 Apr 2019 15:52:05 +0300 Subject: [PATCH 069/184] release version 2.0.18 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8ffc76db4..7cf03fadd 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", From 088c23462dcec61af9fa0ae03a9ce05428d7ac78 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 23 Apr 2019 15:52:21 +0300 Subject: [PATCH 070/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7cf03fadd..8ffc76db4 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", From 9b4ae9c4ab1717a4498d41cc44dea9be352f09f9 Mon Sep 17 00:00:00 2001 From: Rafael Barros Date: Tue, 14 May 2019 13:07:55 -0300 Subject: [PATCH 071/184] Added a .htaccess file to the web directory (#206) --- web/.htaccess | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 web/.htaccess diff --git a/web/.htaccess b/web/.htaccess new file mode 100644 index 000000000..197199e8d --- /dev/null +++ b/web/.htaccess @@ -0,0 +1,4 @@ +RewriteEngine on +RewriteCond %{REQUEST_FILENAME} !-d +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule . index.php [L] From 0adae663e1d0f5fc048294ab658d8621aef9d247 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 21 May 2019 19:03:57 +0300 Subject: [PATCH 072/184] release version 2.0.19 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8ffc76db4..7cf03fadd 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", From 14ae1633457fe7cf18597033e6ac0a892eb96ee7 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 21 May 2019 19:04:19 +0300 Subject: [PATCH 073/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7cf03fadd..8ffc76db4 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", From 00221016a2f089a5715af6f7fea5115e2566df51 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 23 May 2019 18:29:35 +0300 Subject: [PATCH 074/184] Create FUNDING.yml --- .github/FUNDING.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 000000000..89a45e51c --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,4 @@ +# These are supported funding model platforms + +github: [samdark, machour, silverfire, cebe] +open_collective: yiisoft From d587bd0705e6f81a61d27183ee2ef59be8215deb Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 12 Jun 2019 23:01:56 +0300 Subject: [PATCH 075/184] Removed dev stability flag from readme [skip ci] --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6acc916b2..287a6ff87 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ at [getcomposer.org](http://getcomposer.org/doc/00-intro.md#installation-nix). You can then install this project template using the following command: ~~~ -php composer.phar create-project --prefer-dist --stability=dev yiisoft/yii2-app-basic basic +composer create-project --prefer-dist yiisoft/yii2-app-basic basic ~~~ Now you should be able to access the application through the following URL, assuming `basic` is the directory From 9f62ee2af5232ee564d930db08ffd9827c2cb202 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 2 Jul 2019 15:39:05 +0300 Subject: [PATCH 076/184] Remove github from funding options [skip ci] --- .github/FUNDING.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 89a45e51c..c0c1cacbc 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,4 +1,3 @@ # These are supported funding model platforms -github: [samdark, machour, silverfire, cebe] open_collective: yiisoft From 4223df0b861ae6165beaadc64af9835528c63503 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 2 Jul 2019 23:48:04 +0300 Subject: [PATCH 077/184] release version 2.0.22 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8ffc76db4..7cf03fadd 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", From fc049dda1286dd9ab955635aa8d0a8e8ee029a88 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 2 Jul 2019 23:48:17 +0300 Subject: [PATCH 078/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7cf03fadd..8ffc76db4 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", From 928e0b6b8221ad55bb706adaaca440ef8298c538 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 4 Sep 2019 00:44:59 +0300 Subject: [PATCH 079/184] release version 2.0.26 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 8ffc76db4..7cf03fadd 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", From ff3baf4d3aa87a3321c279691f30f6f553af5d63 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 4 Sep 2019 00:45:12 +0300 Subject: [PATCH 080/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7cf03fadd..8ffc76db4 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", From 7e643e7da5fef21186929842a01906bb43bd3f6c Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 4 Sep 2019 01:50:29 +0300 Subject: [PATCH 081/184] Fix travis build --- .travis.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 18e63d91a..aa4b85026 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,17 @@ language: php -php: - - 5.4 - - 5.5 - - 5.6 - - 7.0 - - 7.1 -# - hhvm +matrix: + fast_finish: true + include: + - php: "7.3" + - php: "7.2" + - php: "7.1" + - php: "7.0" + - php: "5.6" + - php: "5.5" + dist: trusty + - php: "5.4" + dist: trusty # faster builds on new travis setup not using sudo sudo: false From 660ebb41df50638b42d6c1ffb2983620a87b9b7d Mon Sep 17 00:00:00 2001 From: Gintautas Miselis Date: Fri, 22 Nov 2019 21:02:47 +0200 Subject: [PATCH 082/184] Upgrade to Codeception 4.0 (#218) * Use modular Codeception 4.0 * Moved bootstrap setting to top level Because old location is deprecated See https://bit.ly/2YrRzVc * Use stringContainsString instead of contains Because using assertContains() with string haystacks is deprecated and will not be supported in PHPUnit 9. * Removed 5.4 and 5.5 --- .travis.yml | 4 ---- codeception.yml | 2 +- composer.json | 10 ++++++---- tests/unit/models/ContactFormTest.php | 2 +- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index aa4b85026..4583c1bf4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,10 +8,6 @@ matrix: - php: "7.1" - php: "7.0" - php: "5.6" - - php: "5.5" - dist: trusty - - php: "5.4" - dist: trusty # faster builds on new travis setup not using sudo sudo: false diff --git a/codeception.yml b/codeception.yml index a95affe04..d5aecb308 100644 --- a/codeception.yml +++ b/codeception.yml @@ -1,11 +1,11 @@ actor: Tester +bootstrap: _bootstrap.php paths: tests: tests log: tests/_output data: tests/_data helpers: tests/_support settings: - bootstrap: _bootstrap.php memory_limit: 1024M colors: true modules: diff --git a/composer.json b/composer.json index 8ffc76db4..324bd02ea 100644 --- a/composer.json +++ b/composer.json @@ -23,11 +23,13 @@ "yiisoft/yii2-debug": "~2.1.0", "yiisoft/yii2-gii": "~2.1.0", "yiisoft/yii2-faker": "~2.0.0", - - "codeception/base": "~2.3.0", - "codeception/verify": "~0.4.0", + "codeception/codeception": "4.0.x-dev | ^4.0", + "codeception/verify": "~0.5.0 || ~1.1.0", "codeception/specify": "~0.4.6", - "symfony/browser-kit": ">=2.7 <=4.2.4" + "symfony/browser-kit": ">=2.7 <=4.2.4", + "codeception/module-filesystem": "^1.0.0", + "codeception/module-yii2": "^1.0.0", + "codeception/module-asserts": "^1.0.0" }, "config": { "process-timeout": 1800, diff --git a/tests/unit/models/ContactFormTest.php b/tests/unit/models/ContactFormTest.php index 031d2bd4f..074448771 100644 --- a/tests/unit/models/ContactFormTest.php +++ b/tests/unit/models/ContactFormTest.php @@ -43,6 +43,6 @@ public function testEmailIsSentOnContact() expect($emailMessage->getFrom())->hasKey('noreply@example.com'); expect($emailMessage->getReplyTo())->hasKey('tester@example.com'); expect($emailMessage->getSubject())->equals('very important letter subject'); - expect($emailMessage->toString())->contains('body of current message'); + expect($emailMessage->toString())->stringContainsString('body of current message'); } } From 2cbc7fccb7bc3fa60240783eeeea809bb7fd76d0 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 6 Dec 2019 19:16:12 +0300 Subject: [PATCH 083/184] Migrate Travis from .org to .com --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 287a6ff87..28b0c2ed3 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ features to your application. [![Latest Stable Version](https://img.shields.io/packagist/v/yiisoft/yii2-app-basic.svg)](https://packagist.org/packages/yiisoft/yii2-app-basic) [![Total Downloads](https://img.shields.io/packagist/dt/yiisoft/yii2-app-basic.svg)](https://packagist.org/packages/yiisoft/yii2-app-basic) -[![Build Status](https://travis-ci.org/yiisoft/yii2-app-basic.svg?branch=master)](https://travis-ci.org/yiisoft/yii2-app-basic) +[![Build Status](https://travis-ci.com/yiisoft/yii2-app-basic.svg?branch=master)](https://travis-ci.com/yiisoft/yii2-app-basic) DIRECTORY STRUCTURE ------------------- From a3534702cdb8f74b2414b66d7ae835f5887c0bcb Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 18 Dec 2019 16:02:37 +0300 Subject: [PATCH 084/184] release version 2.0.31 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 324bd02ea..75d9c29ec 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", From eaabb0fdb496d4e990dc35357174d18324d4cc56 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 18 Dec 2019 16:02:55 +0300 Subject: [PATCH 085/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 75d9c29ec..324bd02ea 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.4.0", "yiisoft/yii2": "~2.0.14", From d9dd911eee10cf833b844dba25aa38e61ce5c98a Mon Sep 17 00:00:00 2001 From: Robert Korulczyk Date: Tue, 24 Dec 2019 11:09:46 +0100 Subject: [PATCH 086/184] Update PHP requirements after bumping Codeception (#219) --- README.md | 2 +- composer.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 28b0c2ed3..fe3c1528f 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ DIRECTORY STRUCTURE REQUIREMENTS ------------ -The minimum requirement by this project template that your Web server supports PHP 5.4.0. +The minimum requirement by this project template that your Web server supports PHP 5.6.0. INSTALLATION diff --git a/composer.json b/composer.json index 324bd02ea..d0a5e2889 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ }, "minimum-stability": "dev", "require": { - "php": ">=5.4.0", + "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", "yiisoft/yii2-bootstrap": "~2.0.0", "yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0" @@ -23,7 +23,7 @@ "yiisoft/yii2-debug": "~2.1.0", "yiisoft/yii2-gii": "~2.1.0", "yiisoft/yii2-faker": "~2.0.0", - "codeception/codeception": "4.0.x-dev | ^4.0", + "codeception/codeception": "^4.0", "codeception/verify": "~0.5.0 || ~1.1.0", "codeception/specify": "~0.4.6", "symfony/browser-kit": ">=2.7 <=4.2.4", From d6a48353cc3b8a548556da5c1594411ec0cfb06d Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 22 Jan 2020 01:38:32 +0300 Subject: [PATCH 087/184] release version 2.0.32 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d0a5e2889..739328036 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From bc5fae6cc0c495cce6d2c095c4b321ca3ebb4fc4 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 22 Jan 2020 01:38:53 +0300 Subject: [PATCH 088/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 739328036..d0a5e2889 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From f6683cd10da3d39fe54ed04bf363846db8a809cc Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 24 Mar 2020 23:33:58 +0300 Subject: [PATCH 089/184] release version 2.0.33 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d0a5e2889..739328036 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From 7efa02c17534260dd2a95a5d0a882ce5831354c4 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 24 Mar 2020 23:34:15 +0300 Subject: [PATCH 090/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 739328036..d0a5e2889 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From e7a77ad5b195e04b673daf6184d96e530e94beee Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 26 Mar 2020 23:53:44 +0300 Subject: [PATCH 091/184] release version 2.0.34 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d0a5e2889..739328036 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From aeda534dfdd7d080a0fcb8d3dcbb486796da0e08 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 26 Mar 2020 23:54:01 +0300 Subject: [PATCH 092/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 739328036..d0a5e2889 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From ead01a9e66d5c018a72c494f87309efdfbb28bad Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 2 May 2020 14:23:27 +0300 Subject: [PATCH 093/184] release version 2.0.35 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d0a5e2889..739328036 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From db08432751ba63fe2fe079271b222c07ec53c89c Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 2 May 2020 14:23:46 +0300 Subject: [PATCH 094/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 739328036..d0a5e2889 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From 8a50308e089f4aa7bbe36df73dce15a80bfc64a9 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 25 Jun 2020 17:25:16 +0300 Subject: [PATCH 095/184] Update meta --- .github/FUNDING.yml | 1 + .github/SECURITY.md | 6 ++++++ 2 files changed, 7 insertions(+) create mode 100644 .github/SECURITY.md diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index c0c1cacbc..692239301 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,3 +1,4 @@ # These are supported funding model platforms open_collective: yiisoft +tidelift: "packagist/yiisoft/yii2-app-basic" diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 000000000..f71384759 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,6 @@ +# Security Policy + +Please use the [security issue form](https://www.yiiframework.com/security) to report to us any security issue you find in Yii. +DO NOT use the issue tracker or discuss it in the public forum as it will cause more damage than help. + +Please note that as a non-commerial OpenSource project we are not able to pay bounties at the moment. From 06a1e468dc1e18c460d40b503166d613bc9083b6 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 8 Jul 2020 00:55:17 +0300 Subject: [PATCH 096/184] release version 2.0.36 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d0a5e2889..739328036 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From beffef99246369b18415c5e8295396b801f68f7d Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 8 Jul 2020 00:55:35 +0300 Subject: [PATCH 097/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 739328036..d0a5e2889 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From c76b9a3bb9d56c27805c3dd758f173fc7b0f5c20 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 7 Aug 2020 23:21:27 +0300 Subject: [PATCH 098/184] release version 2.0.37 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d0a5e2889..739328036 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From f5f03e1dced295f2de6aed52b760793dfe4b4ee5 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 7 Aug 2020 23:21:43 +0300 Subject: [PATCH 099/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 739328036..d0a5e2889 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From 988e7283a630abdc8c7b7928a19f9f9e81dbfef7 Mon Sep 17 00:00:00 2001 From: Nazar Holubovskyy Date: Fri, 4 Sep 2020 18:33:21 +0100 Subject: [PATCH 100/184] Cleaner bash-shell instructions to install MySQL (#228) --- vagrant/provision/once-as-root.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/vagrant/provision/once-as-root.sh b/vagrant/provision/once-as-root.sh index 311d77b4c..ad596039d 100644 --- a/vagrant/provision/once-as-root.sh +++ b/vagrant/provision/once-as-root.sh @@ -22,8 +22,8 @@ info "Configure timezone" timedatectl set-timezone ${timezone} --no-ask-password info "Prepare root password for MySQL" -debconf-set-selections <<< "mariadb-server-10.0 mysql-server/root_password password \"''\"" -debconf-set-selections <<< "mariadb-server-10.0 mysql-server/root_password_again password \"''\"" +debconf-set-selections <<< 'mariadb-server mysql-server/root_password password' +debconf-set-selections <<< 'mariadb-server mysql-server/root_password_again password' echo "Done!" info "Update OS software" @@ -34,11 +34,11 @@ info "Install additional software" apt-get install -y php7.0-curl php7.0-cli php7.0-intl php7.0-mysqlnd php7.0-gd php7.0-fpm php7.0-mbstring php7.0-xml unzip nginx mariadb-server-10.0 php.xdebug info "Configure MySQL" -sed -i "s/.*bind-address.*/bind-address = 0.0.0.0/" /etc/mysql/mariadb.conf.d/50-server.cnf -mysql -uroot <<< "CREATE USER 'root'@'%' IDENTIFIED BY ''" -mysql -uroot <<< "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'" -mysql -uroot <<< "DROP USER 'root'@'localhost'" -mysql -uroot <<< "FLUSH PRIVILEGES" +sed -i 's/.*bind-address.*/bind-address = 0.0.0.0/' /etc/mysql/mariadb.conf.d/50-server.cnf +mysql <<< "CREATE USER 'root'@'%' IDENTIFIED BY ''" +mysql <<< "GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'" +mysql <<< "DROP USER 'root'@'localhost'" +mysql <<< 'FLUSH PRIVILEGES' echo "Done!" info "Configure PHP-FPM" @@ -67,8 +67,8 @@ rm /etc/nginx/sites-enabled/default echo "Done!" info "Initailize databases for MySQL" -mysql -uroot <<< "CREATE DATABASE yii2basic" -mysql -uroot <<< "CREATE DATABASE yii2basic_test" +mysql <<< 'CREATE DATABASE yii2basic' +mysql <<< 'CREATE DATABASE yii2basic_test' echo "Done!" info "Install composer" From eb265a4edb6020d3439eb6f3c7a5d041141d4428 Mon Sep 17 00:00:00 2001 From: Nazar Holubovskyy Date: Fri, 4 Sep 2020 20:19:20 +0100 Subject: [PATCH 101/184] Add virtual machine IP to the Yii2 "allowedIPs" (#229) --- Vagrantfile | 2 +- vagrant/provision/once-as-root.sh | 4 +++ vagrant/provision/provision.awk | 50 +++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 vagrant/provision/provision.awk diff --git a/Vagrantfile b/Vagrantfile index 44fd76c6d..99c2a7831 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -72,7 +72,7 @@ Vagrant.configure(2) do |config| # config.vbguest.auto_update = false # provisioners - config.vm.provision 'shell', path: './vagrant/provision/once-as-root.sh', args: [options['timezone']] + config.vm.provision 'shell', path: './vagrant/provision/once-as-root.sh', args: [options['timezone'], options['ip']] config.vm.provision 'shell', path: './vagrant/provision/once-as-vagrant.sh', args: [options['github_token']], privileged: false config.vm.provision 'shell', path: './vagrant/provision/always-as-root.sh', run: 'always' diff --git a/vagrant/provision/once-as-root.sh b/vagrant/provision/once-as-root.sh index ad596039d..689a7af39 100644 --- a/vagrant/provision/once-as-root.sh +++ b/vagrant/provision/once-as-root.sh @@ -3,6 +3,7 @@ #== Import script args == timezone=$(echo "$1") +readonly IP=$2 #== Bash helpers == @@ -21,6 +22,9 @@ export DEBIAN_FRONTEND=noninteractive info "Configure timezone" timedatectl set-timezone ${timezone} --no-ask-password +info "Add the VM IP to the list of allowed IPs" +awk -v ip=$IP -f /app/vagrant/provision/provision.awk /app/config/web.php + info "Prepare root password for MySQL" debconf-set-selections <<< 'mariadb-server mysql-server/root_password password' debconf-set-selections <<< 'mariadb-server mysql-server/root_password_again password' diff --git a/vagrant/provision/provision.awk b/vagrant/provision/provision.awk new file mode 100644 index 000000000..bcf44d3be --- /dev/null +++ b/vagrant/provision/provision.awk @@ -0,0 +1,50 @@ +### +# Modifying Yii2's files for Vagrant VM +# +# @author HA3IK +# @version 1.0.0 + +BEGIN { + print "AWK BEGINs its work:" + IGNORECASE = 1 + + # Correct IP - wildcard last octet + match(ip, /(([0-9]+\.)+)/, arr) + ip = arr[1] "*" +} +# BODY +{ + # Check if it's the same file + if (FILENAME != isFile["same"]){ + msg = "- Work with: " FILENAME + # Close a previous file + close(isFile["same"]) + # Delete previous data + delete isFile + # Save current file + isFile["same"] = FILENAME + # Define array index for the file + switch (FILENAME){ + case /config\/web\.php$/: + isFile["IsConfWeb"] = 1 + msg = msg " - add allowed IP: " ip + break + } + # Print the concatenated message for the file + print msg + } + + # IF config/web.php + if (isFile["IsConfWeb"]){ + # IF line has "allowedIPs" and doesn't has our IP + if (match($0, "allowedIPs") && !match($0, ip)){ + match($0, /([^\]]+)(.+)/, arr) + $0 = sprintf("%s, '%s'%s", arr[1], ip, arr[2]) + } + # Rewrite the file + print $0 > FILENAME + } +} +END { + print "AWK ENDs its work." +} From 9e0b45841baff3d212b0422e1d860f5eac98c20d Mon Sep 17 00:00:00 2001 From: Nazar Holubovskyy Date: Fri, 4 Sep 2020 23:42:12 +0100 Subject: [PATCH 102/184] Enh: Vagrant process is not interrupted, now, after the installation of each plugin (#227) --- Vagrantfile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 99c2a7831..73a04c7c6 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,9 +1,19 @@ require 'yaml' require 'fileutils' +required_plugins_installed = nil required_plugins = %w( vagrant-hostmanager vagrant-vbguest ) required_plugins.each do |plugin| - exec "vagrant plugin install #{plugin}" unless Vagrant.has_plugin? plugin + unless Vagrant.has_plugin? plugin + system "vagrant plugin install #{plugin}" + required_plugins_installed = true + end +end + +# IF plugin[s] was just installed - restart required +if required_plugins_installed + system "vagrant up" + exit end domains = { From 6c12534a70d23573a2e2a85cefaf53c76b29897e Mon Sep 17 00:00:00 2001 From: Nazar Holubovskyy Date: Sat, 5 Sep 2020 19:58:16 +0100 Subject: [PATCH 103/184] Bug: rm "blacklist" from the codeception.yml; corrected "TESTING" instruction in README.md (#231) --- README.md | 6 +++--- codeception.yml | 9 --------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index fe3c1528f..96832d7c1 100644 --- a/README.md +++ b/README.md @@ -221,13 +221,13 @@ to collect code coverage. You can run your tests and collect coverage with the f ``` #collect coverage for all tests -vendor/bin/codecept run -- --coverage-html --coverage-xml +vendor/bin/codecept run --coverage --coverage-html --coverage-xml #collect coverage only for unit tests -vendor/bin/codecept run unit -- --coverage-html --coverage-xml +vendor/bin/codecept run unit --coverage --coverage-html --coverage-xml #collect coverage for unit and functional tests -vendor/bin/codecept run functional,unit -- --coverage-html --coverage-xml +vendor/bin/codecept run functional,unit --coverage --coverage-html --coverage-xml ``` You can see code coverage output under the `tests/_output` directory. diff --git a/codeception.yml b/codeception.yml index d5aecb308..c8c21690d 100644 --- a/codeception.yml +++ b/codeception.yml @@ -25,12 +25,3 @@ modules: # - controllers/* # - commands/* # - mail/* -# blacklist: -# include: -# - assets/* -# - config/* -# - runtime/* -# - vendor/* -# - views/* -# - web/* -# - tests/* From e319588b18e9e056a714835190ab040887ec4319 Mon Sep 17 00:00:00 2001 From: Nazar Holubovskyy Date: Sun, 6 Sep 2020 13:54:51 +0100 Subject: [PATCH 104/184] Updated Vagrant box to Ubuntu 18.04 with PHP 7.2 etc (#176) (#230) --- Vagrantfile | 2 +- vagrant/nginx/app.conf | 2 +- vagrant/provision/always-as-root.sh | 4 ++-- vagrant/provision/once-as-root.sh | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 73a04c7c6..d752f5b92 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -41,7 +41,7 @@ end # vagrant configurate Vagrant.configure(2) do |config| # select the box - config.vm.box = 'bento/ubuntu-16.04' + config.vm.box = 'bento/ubuntu-18.04' # should we ask about box updates? config.vm.box_check_update = options['box_check_update'] diff --git a/vagrant/nginx/app.conf b/vagrant/nginx/app.conf index b22e66106..1bfc0d583 100644 --- a/vagrant/nginx/app.conf +++ b/vagrant/nginx/app.conf @@ -28,7 +28,7 @@ server { include fastcgi_params; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #fastcgi_pass 127.0.0.1:9000; - fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; + fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; try_files $uri =404; } diff --git a/vagrant/provision/always-as-root.sh b/vagrant/provision/always-as-root.sh index e5d8e33e1..17fb58421 100644 --- a/vagrant/provision/always-as-root.sh +++ b/vagrant/provision/always-as-root.sh @@ -13,6 +13,6 @@ function info { info "Provision-script user: `whoami`" info "Restart web-stack" -service php7.0-fpm restart +service php7.2-fpm restart service nginx restart -service mysql restart \ No newline at end of file +service mysql restart diff --git a/vagrant/provision/once-as-root.sh b/vagrant/provision/once-as-root.sh index 689a7af39..75cbf5a2c 100644 --- a/vagrant/provision/once-as-root.sh +++ b/vagrant/provision/once-as-root.sh @@ -35,7 +35,7 @@ apt-get update apt-get upgrade -y info "Install additional software" -apt-get install -y php7.0-curl php7.0-cli php7.0-intl php7.0-mysqlnd php7.0-gd php7.0-fpm php7.0-mbstring php7.0-xml unzip nginx mariadb-server-10.0 php.xdebug +apt-get install -y php7.2-curl php7.2-cli php7.2-intl php7.2-mysqlnd php7.2-gd php7.2-fpm php7.2-mbstring php7.2-xml unzip nginx mariadb-server-10.1 php.xdebug info "Configure MySQL" sed -i 's/.*bind-address.*/bind-address = 0.0.0.0/' /etc/mysql/mariadb.conf.d/50-server.cnf @@ -46,10 +46,10 @@ mysql <<< 'FLUSH PRIVILEGES' echo "Done!" info "Configure PHP-FPM" -sed -i 's/user = www-data/user = vagrant/g' /etc/php/7.0/fpm/pool.d/www.conf -sed -i 's/group = www-data/group = vagrant/g' /etc/php/7.0/fpm/pool.d/www.conf -sed -i 's/owner = www-data/owner = vagrant/g' /etc/php/7.0/fpm/pool.d/www.conf -cat << EOF > /etc/php/7.0/mods-available/xdebug.ini +sed -i 's/user = www-data/user = vagrant/g' /etc/php/7.2/fpm/pool.d/www.conf +sed -i 's/group = www-data/group = vagrant/g' /etc/php/7.2/fpm/pool.d/www.conf +sed -i 's/owner = www-data/owner = vagrant/g' /etc/php/7.2/fpm/pool.d/www.conf +cat << EOF > /etc/php/7.2/mods-available/xdebug.ini zend_extension=xdebug.so xdebug.remote_enable=1 xdebug.remote_connect_back=1 @@ -76,4 +76,4 @@ mysql <<< 'CREATE DATABASE yii2basic_test' echo "Done!" info "Install composer" -curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ No newline at end of file +curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer From 7cc58b3e39c80db99cdb1da0806847b05cabeb01 Mon Sep 17 00:00:00 2001 From: Nazar Holubovskyy Date: Tue, 8 Sep 2020 23:38:53 +0100 Subject: [PATCH 105/184] `yii2_basic_tests` database is renamed to `yii2basic_test` (#232) --- .travis.yml | 2 +- README.md | 2 +- config/test_db.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4583c1bf4..846a0ad8f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ services: - mysql before_install: - - mysql -e 'CREATE DATABASE IF NOT EXISTS yii2_basic_tests;' + - mysql -e 'CREATE DATABASE IF NOT EXISTS yii2basic_test;' install: - travis_retry composer self-update && composer --version diff --git a/README.md b/README.md index 96832d7c1..116f82fd2 100644 --- a/README.md +++ b/README.md @@ -186,7 +186,7 @@ To execute acceptance tests do the following: docker run --net=host selenium/standalone-firefox:2.53.0 ``` -5. (Optional) Create `yii2_basic_tests` database and update it by applying migrations if you have them. +5. (Optional) Create `yii2basic_test` database and update it by applying migrations if you have them. ``` tests/bin/yii migrate diff --git a/config/test_db.php b/config/test_db.php index 5d213e135..f4290e0b0 100644 --- a/config/test_db.php +++ b/config/test_db.php @@ -1,6 +1,6 @@ Date: Thu, 10 Sep 2020 23:40:36 +0100 Subject: [PATCH 106/184] Bug: Repeat CLI command after Vagrant plugin[s] installation nonstop (#233) --- Vagrantfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index d752f5b92..258aea601 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -12,7 +12,8 @@ end # IF plugin[s] was just installed - restart required if required_plugins_installed - system "vagrant up" + # Get CLI command[s] and call again + system 'vagrant' + ARGV.to_s.gsub(/\[\"|\", \"|\"\]/, ' ') exit end From 60f6fa0f70738e54cb249a6e1635d37cb3577917 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula <42547589+terabytesoftw@users.noreply.github.com> Date: Mon, 14 Sep 2020 07:14:26 -0300 Subject: [PATCH 107/184] Switch to GitHub actions (#234) --- .github/workflows/ci-linux.yml | 81 ++++++++++++++++++++++++++++++++ .github/workflows/ci-windows.yml | 76 ++++++++++++++++++++++++++++++ .travis.yml | 46 ------------------ README.md | 3 +- 4 files changed, 159 insertions(+), 47 deletions(-) create mode 100644 .github/workflows/ci-linux.yml create mode 100644 .github/workflows/ci-windows.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml new file mode 100644 index 000000000..43b27b906 --- /dev/null +++ b/.github/workflows/ci-linux.yml @@ -0,0 +1,81 @@ +on: + - pull_request + - push + +name: ci-linux + +jobs: + tests: + name: PHP ${{ matrix.php-version }} + env: + extensions: curl, dom, gd, imagick, intl, json, mbstring, libxml, xml, xmlwriter + key: cache-v1 + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: + - ubuntu-latest + + php-version: + - "5.6" + - "7.0" + - "7.1" + - "7.2" + - "7.3" + - "7.4" + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup cache environment + id: cache-env + uses: shivammathur/cache-extensions@v1 + with: + php-version: ${{ matrix.php-version }} + extensions: ${{ env.extensions }} + key: ${{ env.key }} + + - name: Cache extensions + uses: actions/cache@v1 + with: + path: ${{ steps.cache-env.outputs.dir }} + key: ${{ steps.cache-env.outputs.key }} + restore-keys: ${{ steps.cache-env.outputs.key }} + + - name: Install PHP with extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + extensions: ${{ env.extensions }} + ini-values: date.timezone='UTC' + coverage: xdebug + tools: composer:v2, pecl + + - name: Determine composer cache directory on Linux + run: echo "::set-env name=COMPOSER_CACHE_DIR::$(composer config cache-dir)" + + - name: Cache dependencies installed with composer + uses: actions/cache@v1 + with: + path: ${{ env.COMPOSER_CACHE_DIR }} + key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }} + restore-keys: | + php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}- + + - name: Install dependencies with composer php PHP [5.6 - 7.4] + run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader + + - name: Run tests with codeception with coverage on Linux PHP [5.6 - 7.4] + run: | + sed -i "s/'cookieValidationKey' => ''/'cookieValidationKey' => 'testkey'/" config/web.php + php -S 127.0.0.1:8080 -t public > ./runtime/yii.log 2>&1 & + vendor/bin/codecept run --coverage --coverage-xml + + - name: Upload code coverage scrutinizer on Linux PHP 7.4 + if: matrix.php-version == '7.4' + run: | + wget https://scrutinizer-ci.com/ocular.phar + php ocular.phar code-coverage:upload --format=php-clover tests/_output/coverage.xml \ No newline at end of file diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml new file mode 100644 index 000000000..40a2a0c33 --- /dev/null +++ b/.github/workflows/ci-windows.yml @@ -0,0 +1,76 @@ +on: + - pull_request + - push + +name: ci-windows + +jobs: + tests: + name: PHP ${{ matrix.php-version }} + env: + extensions: curl, dom, gd, intl, json, mbstring, libxml, xml, xmlwriter + key: cache-v1 + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: + - windows-latest + + php-version: + - "5.6" + - "7.0" + - "7.1" + - "7.2" + - "7.3" + - "7.4" + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup cache environment + id: cache-env + uses: shivammathur/cache-extensions@v1 + with: + php-version: ${{ matrix.php-version }} + extensions: ${{ env.extensions }} + key: ${{ env.key }} + + - name: Cache extensions + uses: actions/cache@v1 + with: + path: ${{ steps.cache-env.outputs.dir }} + key: ${{ steps.cache-env.outputs.key }} + restore-keys: ${{ steps.cache-env.outputs.key }} + + - name: Install PHP with extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + extensions: ${{ env.extensions }} + ini-values: date.timezone='UTC' + coverage: xdebug + tools: composer:v2, pecl + + - name: Determine composer cache directory on Windows + run: ECHO "::set-env name=COMPOSER_CACHE_DIR::~\AppData\Local\Composer" + + - name: Cache dependencies installed with composer + uses: actions/cache@v1 + with: + path: ${{ env.COMPOSER_CACHE_DIR }} + key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }} + restore-keys: | + php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}- + + - name: Install dependencies with composer php PHP [5.6 - 7.4] + run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader + + - name: Run tests with codeception on Windows PHP [5.6 - 7.4] + run: | + sed -i "s/'cookieValidationKey' => ''/'cookieValidationKey' => 'testkey'/" config/web.php + php -S 127.0.0.1:8080 -t public > ./runtime/yii.log 2>&1 & + vendor/bin/codecept run + shell: bash \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 846a0ad8f..000000000 --- a/.travis.yml +++ /dev/null @@ -1,46 +0,0 @@ -language: php - -matrix: - fast_finish: true - include: - - php: "7.3" - - php: "7.2" - - php: "7.1" - - php: "7.0" - - php: "5.6" - -# faster builds on new travis setup not using sudo -sudo: false - -# cache vendor dirs -cache: - directories: - - $HOME/.composer/cache - -services: - - mysql - -before_install: - - mysql -e 'CREATE DATABASE IF NOT EXISTS yii2basic_test;' - -install: - - travis_retry composer self-update && composer --version - - travis_retry composer update --dev --prefer-dist --no-interaction - # install php extensions - - | - if (php --version | grep -i HipHop > /dev/null); then - echo "Skipping imagick and gmagick tests on HHVM" - else - pear config-set preferred_state beta - printf "\n" | pecl install imagick - # gmagick is not installed on travis currently - #printf "\n" | pecl install gmagick - fi -# setup application: - - | - sed -i "s/'cookieValidationKey' => ''/'cookieValidationKey' => 'testkey'/" config/web.php - -script: - - | - php -S localhost:8080 -t web > /dev/null 2>&1 & - vendor/bin/codecept run diff --git a/README.md b/README.md index 116f82fd2..7674e3b62 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ features to your application. [![Latest Stable Version](https://img.shields.io/packagist/v/yiisoft/yii2-app-basic.svg)](https://packagist.org/packages/yiisoft/yii2-app-basic) [![Total Downloads](https://img.shields.io/packagist/dt/yiisoft/yii2-app-basic.svg)](https://packagist.org/packages/yiisoft/yii2-app-basic) -[![Build Status](https://travis-ci.com/yiisoft/yii2-app-basic.svg?branch=master)](https://travis-ci.com/yiisoft/yii2-app-basic) +[![ci-linux](https://github.com/yiisoft/yii2-app-basic/workflows/ci-linux/badge.svg)](https://github.com/yiisoft/yii2-app-basic/actions?query=workflow%3Aci-linux) +[![ci-windows](https://github.com/yiisoft/yii2-app-basic/workflows/ci-windows/badge.svg)](https://github.com/yiisoft/yii2-app-basic/actions?query=workflow%3Aci-windows) DIRECTORY STRUCTURE ------------------- From e070a0ae31d156eb7211ec4fb50ed5bef414c1ff Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 15 Sep 2020 01:06:12 +0300 Subject: [PATCH 108/184] release version 2.0.38 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d0a5e2889..739328036 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From b50d3e1dfe73985fb84b54a61a18eb74bb60b1fa Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 15 Sep 2020 01:06:27 +0300 Subject: [PATCH 109/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 739328036..d0a5e2889 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From d969d6cdf6bbd4be7052281c2a03da0e08b63f72 Mon Sep 17 00:00:00 2001 From: Gildus <72762+Gildus@users.noreply.github.com> Date: Wed, 28 Oct 2020 15:14:23 -0500 Subject: [PATCH 110/184] Upgrade PHP version in docker-compose to 7.2 (#238) --- docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index c3800ff53..d943939f7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,9 @@ version: '2' services: php: - image: yiisoftware/yii2-php:7.1-apache + image: yiisoftware/yii2-php:7.2-apache volumes: - ~/.composer-docker/cache:/root/.composer/cache:delegated - ./:/app:delegated ports: - - '8000:80' \ No newline at end of file + - '8000:80' From f95f012873b7965d40a5fcf91fafff2db661c7a1 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 29 Oct 2020 10:59:47 +0300 Subject: [PATCH 111/184] Bump Docker PHP version --- docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose.yml b/docker-compose.yml index d943939f7..86be3bd0d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: '2' services: php: - image: yiisoftware/yii2-php:7.2-apache + image: yiisoftware/yii2-php:7.4-apache volumes: - ~/.composer-docker/cache:/root/.composer/cache:delegated - ./:/app:delegated From 3fe4c34d62fb13ff69efd10a2fafda4433b251a7 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula <42547589+terabytesoftw@users.noreply.github.com> Date: Sat, 31 Oct 2020 13:25:13 -0300 Subject: [PATCH 112/184] Update GitHub actions (#239) --- .github/workflows/{ci-linux.yml => build.yml} | 25 +++--- .github/workflows/ci-windows.yml | 76 ------------------- README.md | 3 +- 3 files changed, 11 insertions(+), 93 deletions(-) rename .github/workflows/{ci-linux.yml => build.yml} (69%) delete mode 100644 .github/workflows/ci-windows.yml diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/build.yml similarity index 69% rename from .github/workflows/ci-linux.yml rename to .github/workflows/build.yml index 43b27b906..848b870bf 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/build.yml @@ -2,11 +2,11 @@ on: - pull_request - push -name: ci-linux +name: build jobs: tests: - name: PHP ${{ matrix.php-version }} + name: PHP ${{ matrix.php }} env: extensions: curl, dom, gd, imagick, intl, json, mbstring, libxml, xml, xmlwriter key: cache-v1 @@ -17,8 +17,9 @@ jobs: matrix: os: - ubuntu-latest + - windows-latest - php-version: + php: - "5.6" - "7.0" - "7.1" @@ -34,7 +35,7 @@ jobs: id: cache-env uses: shivammathur/cache-extensions@v1 with: - php-version: ${{ matrix.php-version }} + php-version: ${{ matrix.php }} extensions: ${{ env.extensions }} key: ${{ env.key }} @@ -48,7 +49,7 @@ jobs: - name: Install PHP with extensions uses: shivammathur/setup-php@v2 with: - php-version: ${{ matrix.php-version }} + php-version: ${{ matrix.php }} extensions: ${{ env.extensions }} ini-values: date.timezone='UTC' coverage: xdebug @@ -61,21 +62,15 @@ jobs: uses: actions/cache@v1 with: path: ${{ env.COMPOSER_CACHE_DIR }} - key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }} + key: php${{ matrix.php }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }} restore-keys: | - php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}- + php${{ matrix.php }}-composer-${{ matrix.dependencies }}- - name: Install dependencies with composer php PHP [5.6 - 7.4] run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader - - name: Run tests with codeception with coverage on Linux PHP [5.6 - 7.4] + - name: Run tests with codeception run: | sed -i "s/'cookieValidationKey' => ''/'cookieValidationKey' => 'testkey'/" config/web.php php -S 127.0.0.1:8080 -t public > ./runtime/yii.log 2>&1 & - vendor/bin/codecept run --coverage --coverage-xml - - - name: Upload code coverage scrutinizer on Linux PHP 7.4 - if: matrix.php-version == '7.4' - run: | - wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover tests/_output/coverage.xml \ No newline at end of file + vendor/bin/codecept run \ No newline at end of file diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml deleted file mode 100644 index 40a2a0c33..000000000 --- a/.github/workflows/ci-windows.yml +++ /dev/null @@ -1,76 +0,0 @@ -on: - - pull_request - - push - -name: ci-windows - -jobs: - tests: - name: PHP ${{ matrix.php-version }} - env: - extensions: curl, dom, gd, intl, json, mbstring, libxml, xml, xmlwriter - key: cache-v1 - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: - - windows-latest - - php-version: - - "5.6" - - "7.0" - - "7.1" - - "7.2" - - "7.3" - - "7.4" - - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Setup cache environment - id: cache-env - uses: shivammathur/cache-extensions@v1 - with: - php-version: ${{ matrix.php-version }} - extensions: ${{ env.extensions }} - key: ${{ env.key }} - - - name: Cache extensions - uses: actions/cache@v1 - with: - path: ${{ steps.cache-env.outputs.dir }} - key: ${{ steps.cache-env.outputs.key }} - restore-keys: ${{ steps.cache-env.outputs.key }} - - - name: Install PHP with extensions - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php-version }} - extensions: ${{ env.extensions }} - ini-values: date.timezone='UTC' - coverage: xdebug - tools: composer:v2, pecl - - - name: Determine composer cache directory on Windows - run: ECHO "::set-env name=COMPOSER_CACHE_DIR::~\AppData\Local\Composer" - - - name: Cache dependencies installed with composer - uses: actions/cache@v1 - with: - path: ${{ env.COMPOSER_CACHE_DIR }} - key: php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }} - restore-keys: | - php${{ matrix.php-version }}-composer-${{ matrix.dependencies }}- - - - name: Install dependencies with composer php PHP [5.6 - 7.4] - run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader - - - name: Run tests with codeception on Windows PHP [5.6 - 7.4] - run: | - sed -i "s/'cookieValidationKey' => ''/'cookieValidationKey' => 'testkey'/" config/web.php - php -S 127.0.0.1:8080 -t public > ./runtime/yii.log 2>&1 & - vendor/bin/codecept run - shell: bash \ No newline at end of file diff --git a/README.md b/README.md index 7674e3b62..6db290bfa 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,7 @@ features to your application. [![Latest Stable Version](https://img.shields.io/packagist/v/yiisoft/yii2-app-basic.svg)](https://packagist.org/packages/yiisoft/yii2-app-basic) [![Total Downloads](https://img.shields.io/packagist/dt/yiisoft/yii2-app-basic.svg)](https://packagist.org/packages/yiisoft/yii2-app-basic) -[![ci-linux](https://github.com/yiisoft/yii2-app-basic/workflows/ci-linux/badge.svg)](https://github.com/yiisoft/yii2-app-basic/actions?query=workflow%3Aci-linux) -[![ci-windows](https://github.com/yiisoft/yii2-app-basic/workflows/ci-windows/badge.svg)](https://github.com/yiisoft/yii2-app-basic/actions?query=workflow%3Aci-windows) +[![build](https://github.com/yiisoft/yii2-app-basic/workflows/build/badge.svg)](https://github.com/yiisoft/yii2-app-basic/actions?query=workflow%3Abuild) DIRECTORY STRUCTURE ------------------- From 0df2109420576d4622d090da67594cd101f8fece Mon Sep 17 00:00:00 2001 From: Wilmer Arambula <42547589+terabytesoftw@users.noreply.github.com> Date: Sat, 31 Oct 2020 14:17:46 -0300 Subject: [PATCH 113/184] Add names to tests * Fix minor corrections. * Add shell bash. * Fix minor corrections. --- .github/workflows/build.yml | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 848b870bf..c2b6bd92e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,9 +6,10 @@ name: build jobs: tests: - name: PHP ${{ matrix.php }} + name: PHP ${{ matrix.php }} - ${{ matrix.os }} + env: - extensions: curl, dom, gd, imagick, intl, json, mbstring, libxml, xml, xmlwriter + extensions: dom, json, gd, imagick key: cache-v1 runs-on: ${{ matrix.os }} @@ -52,12 +53,15 @@ jobs: php-version: ${{ matrix.php }} extensions: ${{ env.extensions }} ini-values: date.timezone='UTC' - coverage: xdebug - tools: composer:v2, pecl - + - name: Determine composer cache directory on Linux + if: matrix.os == 'ubuntu-latest' run: echo "::set-env name=COMPOSER_CACHE_DIR::$(composer config cache-dir)" + - name: Determine composer cache directory on Windows + if: matrix.os == 'windows-latest' + run: ECHO "::set-env name=COMPOSER_CACHE_DIR::~\AppData\Local\Composer" + - name: Cache dependencies installed with composer uses: actions/cache@v1 with: @@ -67,10 +71,11 @@ jobs: php${{ matrix.php }}-composer-${{ matrix.dependencies }}- - name: Install dependencies with composer php PHP [5.6 - 7.4] - run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader + run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - name: Run tests with codeception run: | sed -i "s/'cookieValidationKey' => ''/'cookieValidationKey' => 'testkey'/" config/web.php php -S 127.0.0.1:8080 -t public > ./runtime/yii.log 2>&1 & - vendor/bin/codecept run \ No newline at end of file + vendor/bin/codecept run + shell: bash \ No newline at end of file From e27be4eaf4d7c7278ff596600521ce13d3e830e1 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 10 Nov 2020 14:07:36 +0300 Subject: [PATCH 114/184] release version 2.0.39 --- composer.json | 2 +- models/LoginForm.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index d0a5e2889..739328036 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", diff --git a/models/LoginForm.php b/models/LoginForm.php index cc6af264c..66d658068 100644 --- a/models/LoginForm.php +++ b/models/LoginForm.php @@ -8,7 +8,7 @@ /** * LoginForm is the model behind the login form. * - * @property User|null $user This property is read-only. + * @property-read User|null $user This property is read-only. * */ class LoginForm extends Model From 7959d142a71ce598ee01cae3e81489d7de2be5b6 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Tue, 10 Nov 2020 14:07:54 +0300 Subject: [PATCH 115/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 739328036..d0a5e2889 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From a56693d88f893595d902c55f399355b80acbbac2 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Mon, 16 Nov 2020 16:22:10 +0300 Subject: [PATCH 116/184] Do not mock contact form in test --- tests/unit/models/ContactFormTest.php | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/tests/unit/models/ContactFormTest.php b/tests/unit/models/ContactFormTest.php index 074448771..93313e4a6 100644 --- a/tests/unit/models/ContactFormTest.php +++ b/tests/unit/models/ContactFormTest.php @@ -7,7 +7,6 @@ class ContactFormTest extends \Codeception\Test\Unit { - private $model; /** * @var \UnitTester */ @@ -15,23 +14,17 @@ class ContactFormTest extends \Codeception\Test\Unit public function testEmailIsSentOnContact() { - /** @var ContactForm $model */ - $this->model = $this->getMockBuilder('app\models\ContactForm') - ->setMethods(['validate']) - ->getMock(); + $model = new ContactForm(); - $this->model->expects($this->once()) - ->method('validate') - ->willReturn(true); - - $this->model->attributes = [ + $model->attributes = [ 'name' => 'Tester', 'email' => 'tester@example.com', 'subject' => 'very important letter subject', 'body' => 'body of current message', + 'verifyCode' => 'testme', ]; - expect_that($this->model->contact('admin@example.com')); + expect_that($model->contact('admin@example.com')); // using Yii2 module actions to check email was sent $this->tester->seeEmailIsSent(); From 6b86dabfa33f93ccd3ae090dc95bd2cd1c8c356f Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 23 Dec 2020 18:52:36 +0300 Subject: [PATCH 117/184] release version 2.0.40 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d0a5e2889..739328036 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From b1af6fa7f939281878551f5bed527144dfdc974b Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Wed, 23 Dec 2020 18:53:43 +0300 Subject: [PATCH 118/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 739328036..d0a5e2889 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From cc8f40eb7786c7c58f54bda2aca9e535ed3e6e69 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 4 Mar 2021 01:01:07 +0300 Subject: [PATCH 119/184] release version 2.0.41 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d0a5e2889..739328036 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From 627f25c7b6caca80c14dd8307a6d124a4bf13c38 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 4 Mar 2021 01:01:53 +0300 Subject: [PATCH 120/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 739328036..d0a5e2889 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From d803a014050f53ad7d34a9d9670e973ac806b452 Mon Sep 17 00:00:00 2001 From: Toir427 Date: Wed, 17 Mar 2021 01:16:19 +0500 Subject: [PATCH 121/184] Fix GitHub action --- .github/workflows/build.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c2b6bd92e..af144a0f3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,16 +56,18 @@ jobs: - name: Determine composer cache directory on Linux if: matrix.os == 'ubuntu-latest' - run: echo "::set-env name=COMPOSER_CACHE_DIR::$(composer config cache-dir)" + run: | + echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - name: Determine composer cache directory on Windows if: matrix.os == 'windows-latest' - run: ECHO "::set-env name=COMPOSER_CACHE_DIR::~\AppData\Local\Composer" + run: | + echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" >> $GITHUB_ENV - name: Cache dependencies installed with composer uses: actions/cache@v1 with: - path: ${{ env.COMPOSER_CACHE_DIR }} + path: ${{ steps.cache-env.outputs.dir }} key: php${{ matrix.php }}-composer-${{ matrix.dependencies }}-${{ hashFiles('**/composer.json') }} restore-keys: | php${{ matrix.php }}-composer-${{ matrix.dependencies }}- @@ -78,4 +80,4 @@ jobs: sed -i "s/'cookieValidationKey' => ''/'cookieValidationKey' => 'testkey'/" config/web.php php -S 127.0.0.1:8080 -t public > ./runtime/yii.log 2>&1 & vendor/bin/codecept run - shell: bash \ No newline at end of file + shell: bash From f9189eb40566ef1573a0a43eccf591520f8ea197 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 6 May 2021 00:17:22 +0300 Subject: [PATCH 122/184] release version 2.0.42 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d0a5e2889..739328036 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From 53e83b061ca2fa4557de52b3d124e5c2634ab57a Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Thu, 6 May 2021 00:17:39 +0300 Subject: [PATCH 123/184] prepare for next release --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 739328036..d0a5e2889 100644 --- a/composer.json +++ b/composer.json @@ -12,7 +12,7 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "stable", + "minimum-stability": "dev", "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", From e028d053c08abc15644261e77b5dae001c49d88b Mon Sep 17 00:00:00 2001 From: sinus Date: Sun, 9 May 2021 01:39:52 +0500 Subject: [PATCH 124/184] Update Gii (#247) --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index d0a5e2889..1375c0105 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ }, "require-dev": { "yiisoft/yii2-debug": "~2.1.0", - "yiisoft/yii2-gii": "~2.1.0", + "yiisoft/yii2-gii": "~2.2.0", "yiisoft/yii2-faker": "~2.0.0", "codeception/codeception": "^4.0", "codeception/verify": "~0.5.0 || ~1.1.0", From 0f2ec249687180a87c95bbd0ca7acd88c67462ac Mon Sep 17 00:00:00 2001 From: Bizley Date: Wed, 19 May 2021 14:01:06 +0200 Subject: [PATCH 125/184] Fix #245: Use Bootstrap 4 (#248) --- .github/workflows/build.yml | 3 +- assets/AppAsset.php | 2 +- composer.json | 2 +- views/layouts/main.php | 36 +++++++++--------- views/site/contact.php | 6 +-- views/site/index.php | 10 ++--- views/site/login.php | 14 +++---- web/css/site.css | 73 +++++++++++-------------------------- widgets/Alert.php | 5 ++- 9 files changed, 61 insertions(+), 90 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index af144a0f3..0671f8970 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,6 +27,7 @@ jobs: - "7.2" - "7.3" - "7.4" + - "8.0" steps: - name: Checkout @@ -72,7 +73,7 @@ jobs: restore-keys: | php${{ matrix.php }}-composer-${{ matrix.dependencies }}- - - name: Install dependencies with composer php PHP [5.6 - 7.4] + - name: Install dependencies with composer php PHP [5.6 - 8.0] run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi - name: Run tests with codeception diff --git a/assets/AppAsset.php b/assets/AppAsset.php index 47932b165..3b950fe7d 100644 --- a/assets/AppAsset.php +++ b/assets/AppAsset.php @@ -26,6 +26,6 @@ class AppAsset extends AssetBundle ]; public $depends = [ 'yii\web\YiiAsset', - 'yii\bootstrap\BootstrapAsset', + 'yii\bootstrap4\BootstrapAsset', ]; } diff --git a/composer.json b/composer.json index 1375c0105..e3068b065 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,7 @@ "require": { "php": ">=5.6.0", "yiisoft/yii2": "~2.0.14", - "yiisoft/yii2-bootstrap": "~2.0.0", + "yiisoft/yii2-bootstrap4": "~2.0.0", "yiisoft/yii2-swiftmailer": "~2.0.0 || ~2.1.0" }, "require-dev": { diff --git a/views/layouts/main.php b/views/layouts/main.php index 87dfdcbc9..54d139995 100644 --- a/views/layouts/main.php +++ b/views/layouts/main.php @@ -3,40 +3,39 @@ /* @var $this \yii\web\View */ /* @var $content string */ -use app\widgets\Alert; -use yii\helpers\Html; -use yii\bootstrap\Nav; -use yii\bootstrap\NavBar; -use yii\widgets\Breadcrumbs; use app\assets\AppAsset; +use app\widgets\Alert; +use yii\bootstrap4\Breadcrumbs; +use yii\bootstrap4\Html; +use yii\bootstrap4\Nav; +use yii\bootstrap4\NavBar; AppAsset::register($this); ?> beginPage() ?> - + - - + registerCsrfMetaTags() ?> <?= Html::encode($this->title) ?> head() ?> - + beginBody() ?> -
+
Yii::$app->name, 'brandUrl' => Yii::$app->homeUrl, 'options' => [ - 'class' => 'navbar-inverse navbar-fixed-top', + 'class' => 'navbar navbar-expand-md navbar-dark bg-dark fixed-top', ], ]); echo Nav::widget([ - 'options' => ['class' => 'navbar-nav navbar-right'], + 'options' => ['class' => 'navbar-nav'], 'items' => [ ['label' => 'Home', 'url' => ['/site/index']], ['label' => 'About', 'url' => ['/site/about']], @@ -45,7 +44,7 @@ ['label' => 'Login', 'url' => ['/site/login']] ) : ( '
  • ' - . Html::beginForm(['/site/logout'], 'post') + . Html::beginForm(['/site/logout'], 'post', ['class' => 'form-inline']) . Html::submitButton( 'Logout (' . Yii::$app->user->identity->username . ')', ['class' => 'btn btn-link logout'] @@ -57,7 +56,9 @@ ]); NavBar::end(); ?> +
  • +
    isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], @@ -65,13 +66,12 @@
    -
    + -