diff --git a/.gitignore b/.gitignore index 6482763..5586ab2 100644 --- a/.gitignore +++ b/.gitignore @@ -13,13 +13,15 @@ nbproject Thumbs.db # composer vendor dir -/yii/vendor +/vendor # composer itself is not needed composer.phar +# composer.lock should not be committed as we always want the latest versions +/composer.lock # Mac DS_Store Files .DS_Store # local phpunit config -/phpunit.xml \ No newline at end of file +/phpunit.xml diff --git a/.travis.yml b/.travis.yml index 7e5a002..6eeec4c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,18 +7,22 @@ php: services: - redis-server - memcached + - elasticsearch before_script: - composer self-update && composer --version - composer require satooshi/php-coveralls 0.6.* --dev --prefer-dist - mysql -e 'CREATE DATABASE yiitest;'; + - mysql -D yiitest -u travis < /home/travis/build/yiisoft/yii2/tests/unit/data/sphinx/source.sql - psql -U postgres -c 'CREATE DATABASE yiitest;'; + - echo 'elasticsearch version ' && curl http://localhost:9200/ - tests/unit/data/travis/apc-setup.sh - tests/unit/data/travis/memcache-setup.sh - tests/unit/data/travis/cubrid-setup.sh + - tests/unit/data/travis/sphinx-setup.sh -script: - - phpunit --coverage-clover tests/unit/runtime/coveralls/clover.xml --verbose --exclude-group mssql,oci,wincache,xcache,zenddata,vendor,sphinx +#script: +# - phpunit --coverage-clover tests/unit/runtime/coveralls/clover.xml --verbose --exclude-group mssql,oci,wincache,xcache,zenddata,vendor,sphinx -after_script: - - php vendor/bin/coveralls +#after_script: +# - php vendor/bin/coveralls diff --git a/README.md b/README.md index 3bc2d67..35a50f5 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ without prior notices. **Yii 2.0 is not ready for production use yet.** [![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2/v/stable.png)](https://packagist.org/packages/yiisoft/yii2) [![Total Downloads](https://poser.pugx.org/yiisoft/yii2/downloads.png)](https://packagist.org/packages/yiisoft/yii2) -[![Build Status](https://secure.travis-ci.org/yiisoft/yii2.png)](http://travis-ci.org/yiisoft/yii2) +[![Build Status](https://secure.travis-ci.org/yiisoft/yii2.png)](http://travis-ci.org/yiisoft/yii2) [![Dependency Status](https://www.versioneye.com/php/yiisoft:yii2/dev-master/badge.png)](https://www.versioneye.com/php/yiisoft:yii2/dev-master) @@ -24,7 +24,7 @@ DIRECTORY STRUCTURE benchmark/ app demonstrating the minimal overhead introduced by the framework build/ internally used build tools docs/ documentation - extensions/ extensions + extensions/ extensions framework/ framework files yii/ framework source files tests/ tests of the core framework code diff --git a/apps/advanced/backend/views/layouts/main.php b/apps/advanced/backend/views/layouts/main.php index fdffc26..1857e62 100644 --- a/apps/advanced/backend/views/layouts/main.php +++ b/apps/advanced/backend/views/layouts/main.php @@ -11,16 +11,16 @@ use yii\widgets\Breadcrumbs; */ AppAsset::register($this); ?> -beginPage(); ?> +beginPage() ?> <?= Html::encode($this->title) ?> - head(); ?> + head() ?> - beginBody(); ?> + beginBody() ?> 'My Company', @@ -58,7 +58,7 @@ AppAsset::register($this); - endBody(); ?> + endBody() ?> -endPage(); ?> +endPage() ?> diff --git a/apps/advanced/common/config/params.php b/apps/advanced/common/config/params.php index 4d83098..c378364 100644 --- a/apps/advanced/common/config/params.php +++ b/apps/advanced/common/config/params.php @@ -3,6 +3,7 @@ Yii::setAlias('common', realpath(__DIR__ . '/../')); Yii::setAlias('frontend', realpath(__DIR__ . '/../../frontend')); Yii::setAlias('backend', realpath(__DIR__ . '/../../backend')); +Yii::setAlias('console', realpath(__DIR__ . '/../../console')); return [ 'adminEmail' => 'admin@example.com', @@ -14,6 +15,7 @@ return [ 'components.mail' => [ 'class' => 'yii\swiftmailer\Mailer', + 'viewPath' => '@common/mails', ], 'components.db' => [ diff --git a/apps/advanced/common/mails/layouts/html.php b/apps/advanced/common/mails/layouts/html.php new file mode 100644 index 0000000..2e6b615 --- /dev/null +++ b/apps/advanced/common/mails/layouts/html.php @@ -0,0 +1,24 @@ + +beginPage() ?> + + + + + <?= Html::encode($this->title) ?> + head() ?> + + + beginBody() ?> + + endBody() ?> + + +endPage() ?> \ No newline at end of file diff --git a/apps/advanced/frontend/views/emails/passwordResetToken.php b/apps/advanced/common/mails/passwordResetToken.php similarity index 100% rename from apps/advanced/frontend/views/emails/passwordResetToken.php rename to apps/advanced/common/mails/passwordResetToken.php diff --git a/apps/advanced/console/migrations/m130524_201442_init.php b/apps/advanced/console/migrations/m130524_201442_init.php index 1315d8d..a5935be 100644 --- a/apps/advanced/console/migrations/m130524_201442_init.php +++ b/apps/advanced/console/migrations/m130524_201442_init.php @@ -6,19 +6,21 @@ class m130524_201442_init extends \yii\db\Migration { public function up() { - // MySQL-specific table options. Adjust if you plan working with another DBMS - $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB'; + $tableOptions = null; + if ($this->db->driverName === 'mysql') { + $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_general_ci ENGINE=InnoDB'; + } $this->createTable('tbl_user', [ 'id' => Schema::TYPE_PK, - 'username' => Schema::TYPE_STRING.' NOT NULL', - 'auth_key' => Schema::TYPE_STRING.'(32) NOT NULL', - 'password_hash' => Schema::TYPE_STRING.' NOT NULL', - 'password_reset_token' => Schema::TYPE_STRING.'(32)', - 'email' => Schema::TYPE_STRING.' NOT NULL', - 'role' => 'tinyint NOT NULL DEFAULT 10', + 'username' => Schema::TYPE_STRING . ' NOT NULL', + 'auth_key' => Schema::TYPE_STRING . '(32) NOT NULL', + 'password_hash' => Schema::TYPE_STRING . ' NOT NULL', + 'password_reset_token' => Schema::TYPE_STRING . '(32)', + 'email' => Schema::TYPE_STRING . ' NOT NULL', + 'role' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', - 'status' => 'tinyint NOT NULL DEFAULT 10', + 'status' => Schema::TYPE_SMALLINT . ' NOT NULL DEFAULT 10', 'create_time' => Schema::TYPE_INTEGER.' NOT NULL', 'update_time' => Schema::TYPE_INTEGER.' NOT NULL', ], $tableOptions); diff --git a/apps/advanced/frontend/controllers/SiteController.php b/apps/advanced/frontend/controllers/SiteController.php index 184d16c..edb9cd9 100644 --- a/apps/advanced/frontend/controllers/SiteController.php +++ b/apps/advanced/frontend/controllers/SiteController.php @@ -159,17 +159,11 @@ class SiteController extends Controller $user->password_reset_token = Security::generateRandomKey(); if ($user->save(false)) { - // todo: refactor it with mail component. pay attention to the arrangement of mail view files - $fromEmail = \Yii::$app->params['supportEmail']; - $name = '=?UTF-8?B?' . base64_encode(\Yii::$app->name . ' robot') . '?='; - $subject = '=?UTF-8?B?' . base64_encode('Password reset for ' . \Yii::$app->name) . '?='; - $body = $this->renderPartial('/emails/passwordResetToken', [ - 'user' => $user, - ]); - $headers = "From: $name <{$fromEmail}>\r\n" . - "MIME-Version: 1.0\r\n" . - "Content-type: text/plain; charset=UTF-8"; - return mail($email, $subject, $body, $headers); + return \Yii::$app->mail->compose('passwordResetToken', ['user' => $user]) + ->setFrom([\Yii::$app->params['supportEmail'] => \Yii::$app->name . ' robot']) + ->setTo($email) + ->setSubject('Password reset for ' . \Yii::$app->name) + ->send(); } return false; diff --git a/apps/advanced/frontend/views/layouts/main.php b/apps/advanced/frontend/views/layouts/main.php index febcc5a..7bc03d2 100644 --- a/apps/advanced/frontend/views/layouts/main.php +++ b/apps/advanced/frontend/views/layouts/main.php @@ -12,16 +12,16 @@ use frontend\widgets\Alert; */ AppAsset::register($this); ?> -beginPage(); ?> +beginPage() ?> <?= Html::encode($this->title) ?> - head(); ?> + head() ?> - beginBody(); ?> + beginBody() ?> 'My Company', @@ -63,7 +63,7 @@ AppAsset::register($this); - endBody(); ?> + endBody() ?> -endPage(); ?> +endPage() ?> diff --git a/apps/advanced/frontend/widgets/Alert.php b/apps/advanced/frontend/widgets/Alert.php index e070e1b..390f359 100644 --- a/apps/advanced/frontend/widgets/Alert.php +++ b/apps/advanced/frontend/widgets/Alert.php @@ -27,13 +27,13 @@ class Alert extends \yii\bootstrap\Widget * - $value is the bootstrap alert type (i.e. danger, success, info, warning) */ public $alertTypes = [ - 'error' => 'danger', - 'danger' => 'danger', - 'success' => 'success', - 'info' => 'info', + 'error' => 'danger', + 'danger' => 'danger', + 'success' => 'success', + 'info' => 'info', 'warning' => 'warning' ]; - + /** * @var array the options for rendering the close button tag. */ @@ -49,7 +49,7 @@ class Alert extends \yii\bootstrap\Widget foreach ($flashes as $type => $message) { /* initialize css class for each alert box */ - $this->options['class'] = 'alert-' . $this->alertTypes[$type] . $appendCss; + $this->options['class'] = 'alert-' . $this->alertTypes[$type] . $appendCss; /* assign unique id to each alert box */ $this->options['id'] = $this->getId() . '-' . $type; diff --git a/apps/basic/commands/HelloController.php b/apps/basic/commands/HelloController.php index 29394cd..db36c5a 100644 --- a/apps/basic/commands/HelloController.php +++ b/apps/basic/commands/HelloController.php @@ -13,7 +13,7 @@ use yii\console\Controller; * This command echoes what the first argument that you have entered. * * This command is provided as an example for you to learn how to create console commands. - * + * * @author Qiang Xue * @since 2.0 */ diff --git a/apps/basic/tests/_helpers/CodeHelper.php b/apps/basic/tests/_helpers/CodeHelper.php index 972c8f3..eea532c 100644 --- a/apps/basic/tests/_helpers/CodeHelper.php +++ b/apps/basic/tests/_helpers/CodeHelper.php @@ -1,7 +1,7 @@ dontSeeElement('.error'); @@ -834,7 +834,7 @@ class WebGuy extends \Codeception\AbstractGuy * Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath * * Example: - * + * * ``` php * dontSeeElement('.error'); @@ -854,7 +854,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -873,7 +873,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -892,7 +892,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -911,16 +911,16 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. * ---------------------------------------------- * * Fills a text field or textarea with value. - * + * * Example: - * + * * ``` php * fillField("//input[@type='text']", "Hello World!"); @@ -941,7 +941,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -981,7 +981,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1011,7 +1011,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1040,7 +1040,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1099,7 +1099,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1152,7 +1152,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1209,7 +1209,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1266,7 +1266,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1321,7 +1321,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1376,7 +1376,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1419,7 +1419,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1462,7 +1462,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1485,7 +1485,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1507,7 +1507,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1529,7 +1529,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1560,7 +1560,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1591,7 +1591,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1648,7 +1648,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1705,7 +1705,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1774,7 +1774,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1841,7 +1841,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1874,7 +1874,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1907,7 +1907,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1962,7 +1962,7 @@ class WebGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. diff --git a/apps/basic/tests/functional/TestGuy.php b/apps/basic/tests/functional/TestGuy.php index 553a44f..9da8947 100644 --- a/apps/basic/tests/functional/TestGuy.php +++ b/apps/basic/tests/functional/TestGuy.php @@ -27,7 +27,7 @@ use Codeception\Module\Yii2; class TestGuy extends \Codeception\AbstractGuy { - + /** * This method is generated. * Documentation taken from corresponding module. @@ -49,7 +49,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -79,7 +79,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -106,7 +106,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -133,7 +133,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -161,7 +161,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -220,7 +220,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -281,7 +281,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -336,7 +336,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -355,7 +355,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -412,7 +412,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -439,13 +439,13 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. * ---------------------------------------------- * - * Authenticates user for HTTP_AUTH + * Authenticates user for HTTP_AUTH * * @param $username * @param $password @@ -461,7 +461,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -494,7 +494,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -540,7 +540,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -605,7 +605,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -670,7 +670,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -733,7 +733,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -794,7 +794,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -853,7 +853,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -906,7 +906,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -963,7 +963,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1020,7 +1020,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1075,7 +1075,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1130,7 +1130,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1161,7 +1161,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1224,7 +1224,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1285,7 +1285,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1354,7 +1354,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1421,7 +1421,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1477,16 +1477,16 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. * ---------------------------------------------- * * Fills a text field or textarea with value. - * + * * Example: - * + * * ``` php * fillField("//input[@type='text']", "Hello World!"); @@ -1507,7 +1507,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1547,7 +1547,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1577,7 +1577,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1606,7 +1606,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1637,7 +1637,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1662,7 +1662,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1698,7 +1698,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1731,7 +1731,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1764,7 +1764,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1817,7 +1817,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1826,7 +1826,7 @@ class TestGuy extends \Codeception\AbstractGuy * Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath * * Example: - * + * * ``` php * dontSeeElement('.error'); @@ -1854,7 +1854,7 @@ class TestGuy extends \Codeception\AbstractGuy * Checks if element does not exist (or is visible) on a page, matching it by CSS or XPath * * Example: - * + * * ``` php * dontSeeElement('.error'); @@ -1874,7 +1874,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1931,7 +1931,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -1988,7 +1988,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -2025,7 +2025,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -2068,7 +2068,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. @@ -2123,7 +2123,7 @@ class TestGuy extends \Codeception\AbstractGuy return new Maybe(); } - + /** * This method is generated. * Documentation taken from corresponding module. diff --git a/apps/basic/tests/unit/CodeGuy.php b/apps/basic/tests/unit/CodeGuy.php index 613c754..70165a6 100644 --- a/apps/basic/tests/unit/CodeGuy.php +++ b/apps/basic/tests/unit/CodeGuy.php @@ -25,6 +25,6 @@ use Codeception\Module\CodeHelper; class CodeGuy extends \Codeception\AbstractGuy { - + } diff --git a/apps/basic/views/layouts/main.php b/apps/basic/views/layouts/main.php index 04acdfb..e99b3c5 100644 --- a/apps/basic/views/layouts/main.php +++ b/apps/basic/views/layouts/main.php @@ -11,16 +11,16 @@ use app\assets\AppAsset; */ AppAsset::register($this); ?> -beginPage(); ?> +beginPage() ?> <?= Html::encode($this->title) ?> - head(); ?> + head() ?> -beginBody(); ?> +beginBody() ?> 'My Company', @@ -59,7 +59,7 @@ AppAsset::register($this); -endBody(); ?> +endBody() ?> -endPage(); ?> +endPage() ?> diff --git a/build/build b/build/build index b1d6bb2..daf5e09 100755 --- a/build/build +++ b/build/build @@ -11,6 +11,8 @@ // fcgi doesn't have STDIN defined by default defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); +define('YII_DEBUG', true); + require(__DIR__ . '/../framework/yii/Yii.php'); $application = new yii\console\Application([ diff --git a/build/controllers/PhpDocController.php b/build/controllers/PhpDocController.php index c7a2fa7..0dc0f24 100644 --- a/build/controllers/PhpDocController.php +++ b/build/controllers/PhpDocController.php @@ -7,6 +7,7 @@ namespace yii\build\controllers; +use Yii; use yii\console\Controller; use yii\helpers\Console; use yii\helpers\FileHelper; @@ -38,10 +39,30 @@ class PhpDocController extends Controller * * @param null $root the directory to parse files from. Defaults to YII_PATH. */ - public function actionProperty($root=null) + public function actionProperty($root = null) { + $except = []; if ($root === null) { - $root = YII_PATH; + $root = dirname(dirname(YII_PATH)); + Yii::setAlias('@yii/bootstrap', $root . '/extensions/bootstrap'); + Yii::setAlias('@yii/debug', $root . '/extensions/debug'); + Yii::setAlias('@yii/elasticsearch', $root . '/extensions/elasticsearch'); + Yii::setAlias('@yii/gii', $root . '/extensions/gii'); + Yii::setAlias('@yii/jui', $root . '/extensions/jui'); + Yii::setAlias('@yii/redis', $root . '/extensions/redis'); + Yii::setAlias('@yii/smarty', $root . '/extensions/smarty'); + Yii::setAlias('@yii/sphinx', $root . '/extensions/sphinx'); + Yii::setAlias('@yii/swiftmailer', $root . '/extensions/swiftmailer'); + Yii::setAlias('@yii/twig', $root . '/extensions/twig'); + + $except = [ + '/apps/', + '/build/', + '/docs/', + '/extensions/composer/', + '/tests/', + '/vendor/', + ]; } $root = FileHelper::normalizePath($root); $options = [ @@ -55,14 +76,13 @@ class PhpDocController extends Controller return null; }, 'only' => ['.php'], - 'except' => [ + 'except' => array_merge($except, [ 'BaseYii.php', 'Yii.php', - '/debug/views/', + '/views/', '/requirements/', - '/gii/views/', '/gii/generators/', - ], + ]), ]; $files = FileHelper::findFiles($root, $options); $nFilesTotal = 0; @@ -216,20 +236,27 @@ class PhpDocController extends Controller $ns = $this->match('#\nnamespace (?[\w\\\\]+);\n#', $file); $namespace = reset($ns); $namespace = $namespace['name']; - $classes = $this->match('#\n(?:abstract )?class (?\w+)( |\n)(extends )?.+\{(?.*)\n\}(\n|$)#', $file); + $classes = $this->match('#\n(?:abstract )?class (?\w+)( extends .+)?( implements .+)?\n\{(?.*)\n\}(\n|$)#', $file); if (count($classes) > 1) { $this->stderr("[ERR] There should be only one class in a file: $fileName\n", Console::FG_RED); return false; } if (count($classes) < 1) { - $interfaces = $this->match('#\ninterface (?\w+)\n\{(?.+)\n\}(\n|$)#', $file); + $interfaces = $this->match('#\ninterface (?\w+)( extends .+)?\n\{(?.+)\n\}(\n|$)#', $file); if (count($interfaces) == 1) { return false; } elseif (count($interfaces) > 1) { $this->stderr("[ERR] There should be only one interface in a file: $fileName\n", Console::FG_RED); } else { - $this->stderr("[ERR] No class in file: $fileName\n", Console::FG_RED); + $traits = $this->match('#\ntrait (?\w+)\n\{(?.+)\n\}(\n|$)#', $file); + if (count($traits) == 1) { + return false; + } elseif (count($traits) > 1) { + $this->stderr("[ERR] There should be only one class/trait/interface in a file: $fileName\n", Console::FG_RED); + } else { + $this->stderr("[ERR] No class in file: $fileName\n", Console::FG_RED); + } } return false; } diff --git a/docs/guide/active-record.md b/docs/guide/active-record.md index 90826b0..aa47751 100644 --- a/docs/guide/active-record.md +++ b/docs/guide/active-record.md @@ -3,7 +3,7 @@ Active Record Active Record implements the [Active Record design pattern](http://en.wikipedia.org/wiki/Active_record). The premise behind Active Record is that an individual [[ActiveRecord]] object is associated with a specific row in a database table. The object's attributes are mapped to the columns of the corresponding table. Referencing an Active Record attribute is equivalent to accessing -the corresponding table column for that record. +the corresponding table column for that record. As an example, say that the `Customer` ActiveRecord class is associated with the `tbl_customer` table. This would mean that the class's `name` attribute is automatically mapped to the `name` column in `tbl_customer`. diff --git a/docs/guide/authentication.md b/docs/guide/authentication.md index 0b81f14..e73b11d 100644 --- a/docs/guide/authentication.md +++ b/docs/guide/authentication.md @@ -3,7 +3,7 @@ Authentication Authentication is the act of verifying who a user is, and is the basis of the login process. Typically, authentication uses an identifier--a username or email address--and password, submitted through a form. The application then compares this information against that previously stored. -In Yii all this is done semi-automatically, leaving the developer to merely implement [[\yii\web\IdentityInterface]]. Typically, implementation is accomplished using the `User` model. You can find a full featured example in the +In Yii all this is done semi-automatically, leaving the developer to merely implement [[\yii\web\IdentityInterface]]. Typically, implementation is accomplished using the `User` model. You can find a full featured example in the [advanced application template](installation.md). Below only the interface methods are listed: ```php diff --git a/docs/guide/composer.md b/docs/guide/composer.md index 89eac35..8abef5a 100644 --- a/docs/guide/composer.md +++ b/docs/guide/composer.md @@ -9,7 +9,7 @@ Installing Composer In order to install Composer, check the official guide for your operating system: -* [Linux](http://getcomposer.org/doc/00-intro.md#installation-nix) +* [Linux](http://getcomposer.org/doc/00-intro.md#installation-nix) * [Windows](http://getcomposer.org/doc/00-intro.md#installation-windows) All of the details can be found in the guide, but you'll either download Composer directly from [http://getcomposer.org/](http://getcomposer.org/), or run the following command: diff --git a/docs/guide/controller.md b/docs/guide/controller.md index a668ba7..571a833 100644 --- a/docs/guide/controller.md +++ b/docs/guide/controller.md @@ -167,7 +167,7 @@ public SiteController extends \yii\web\Controller { return [ 'about' => [ - 'class' => '@app/actions/Page', + 'class' => 'app\actions\Page', 'view' => 'about', ], ]; diff --git a/docs/guide/form.md b/docs/guide/form.md index d31d653..5f7082a 100644 --- a/docs/guide/form.md +++ b/docs/guide/form.md @@ -88,3 +88,19 @@ customize the output, you can chain additional methods to this call: field($model, 'username')->textInput()->hint('Please enter your name')->label('Name') ?> ``` + +This will create all the `