diff --git a/.gitignore b/.gitignore index 45bf7bf41..6557c86a6 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,10 @@ composer.phar phpunit.phar # local phpunit config /phpunit.xml + +#Vagrant local files +/.vagrant + +#config files +/config/db.php +/config/env.php diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 000000000..c44639d8d --- /dev/null +++ b/Vagrantfile @@ -0,0 +1,35 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +Vagrant.configure(2) do |config| + config.vm.box = "aauthor/trusty64" + + config.vm.network "forwarded_port", guest: 80, host: 8080, auto_correct: true + config.vm.network "forwarded_port", guest: 3306, host: 3307, auto_correct: true + + config.vm.provider "virtualbox" do |vb| + vb.name="yii2-basic" + end + + config.vm.hostname = "yii2-basic" + + config.vm.provision "shell", path: "vagrant/install.sh" + + # Uncomment the following line to include MySQL into Vagrant configuration + #config.vm.provision "shell", path: "vagrant/install-mysql.sh" + + # Uncomment the following line to include PostgreSQL into Vagrant configuration + #config.vm.provision "shell", path: "vagrant/install-postgre.sh" + + config.vm.provision "shell", path: "vagrant/config.sh" + + # Uncomment the following line to include MySQL into Vagrant configuration + #config.vm.provision "shell", path: "vagrant/config-mysql.sh" + + # Uncomment the following line to include PostgreSQL into Vagrant configuration + #config.vm.provision "shell", path: "vagrant/config-postgre.sh" + + config.vm.provision "shell", path: "vagrant/config-project.sh" + + config.vm.provision "shell", path: "vagrant/startup.sh", run: "always" +end diff --git a/assets/AppAsset.php b/assets/AppAsset.php index 0e495a8f8..6b46c9026 100644 --- a/assets/AppAsset.php +++ b/assets/AppAsset.php @@ -1,29 +1,21 @@ - * @since 2.0 - */ class AppAsset extends AssetBundle { - public $basePath = '@webroot'; - public $baseUrl = '@web'; - public $css = [ - 'css/site.css', - ]; - public $js = [ - ]; - public $depends = [ - 'yii\web\YiiAsset', - 'yii\bootstrap\BootstrapAsset', - ]; + public $sourcePath = '@app/files'; + + public $css = [ + 'less/application.less', + ]; + + public $js = [ + ]; + + public $depends = [ + 'yii\web\JqueryAsset', + 'app\assets\BootstrapAsset' + ]; } diff --git a/assets/BootstrapAsset.php b/assets/BootstrapAsset.php new file mode 100644 index 000000000..7fd7b3be9 --- /dev/null +++ b/assets/BootstrapAsset.php @@ -0,0 +1,18 @@ + + * @since 2.0 + */ +class BootstrapAsset extends AssetBundle +{ + public $sourcePath = '@bower/bootstrap/dist'; + public $js = [ + "js/bootstrap.min.js", + ]; +} diff --git a/commands/HelloController.php b/commands/HelloController.php deleted file mode 100644 index 86ab8b853..000000000 --- a/commands/HelloController.php +++ /dev/null @@ -1,30 +0,0 @@ - - * @since 2.0 - */ -class HelloController extends Controller -{ - /** - * This command echoes what you have entered as the message. - * @param string $message the message to be echoed. - */ - public function actionIndex($message = 'hello world') - { - echo $message . "\n"; - } -} diff --git a/composer.json b/composer.json index 4ad378784..1bdcb8416 100644 --- a/composer.json +++ b/composer.json @@ -12,18 +12,33 @@ "irc": "irc://irc.freenode.net/yii", "source": "https://github.com/yiisoft/yii2" }, - "minimum-stability": "dev", + "minimum-stability": "stable", + + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/CanDo-com/yii2-db.git" + }, + { + "type": "vcs", + "url": "git@github.com:yiisoft/yii2-httpclient.git" + } + ], + "require": { - "php": ">=5.4.0", + "php": ">=5.5.0", + "bower-asset/bootstrap": "3.3.* | 3.2.* | 3.1.*", "yiisoft/yii2": ">=2.0.5", - "yiisoft/yii2-bootstrap": "*", - "yiisoft/yii2-swiftmailer": "*" + "yiisoft/yii2-httpclient": "dev-master", + "yiisoft/yii2-swiftmailer": "*" }, "require-dev": { "yiisoft/yii2-codeception": "*", "yiisoft/yii2-debug": "*", "yiisoft/yii2-gii": "*", - "yiisoft/yii2-faker": "*" + "yiisoft/yii2-faker": "*", + "packagist/closurecompiler-bin": "*", + "cando/yii2-db": "dev-master" }, "config": { "process-timeout": 1800 diff --git a/composer.lock b/composer.lock new file mode 100644 index 000000000..529bc14ee --- /dev/null +++ b/composer.lock @@ -0,0 +1,1068 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "210287e435efdc2f9d9e7d55b449bb81", + "content-hash": "715b04cd64c679964669fa75e9675020", + "packages": [ + { + "name": "bower-asset/bootstrap", + "version": "v3.3.5", + "source": { + "type": "git", + "url": "https://github.com/twbs/bootstrap.git", + "reference": "16b48259a62f576e52c903c476bd42b90ab22482" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twbs/bootstrap/zipball/16b48259a62f576e52c903c476bd42b90ab22482", + "reference": "16b48259a62f576e52c903c476bd42b90ab22482", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.9.1" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": [ + "less/bootstrap.less", + "dist/js/bootstrap.js" + ], + "bower-asset-ignore": [ + "/.*", + "_config.yml", + "CNAME", + "composer.json", + "CONTRIBUTING.md", + "docs", + "js/tests", + "test-infra" + ] + }, + "license": [ + "MIT" + ], + "description": "The most popular front-end framework for developing responsive, mobile first projects on the web.", + "keywords": [ + "css", + "framework", + "front-end", + "js", + "less", + "mobile-first", + "responsive", + "web" + ] + }, + { + "name": "bower-asset/jquery", + "version": "2.1.4", + "source": { + "type": "git", + "url": "https://github.com/jquery/jquery.git", + "reference": "7751e69b615c6eca6f783a81e292a55725af6b85" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jquery/jquery/zipball/7751e69b615c6eca6f783a81e292a55725af6b85", + "reference": "7751e69b615c6eca6f783a81e292a55725af6b85", + "shasum": "" + }, + "require-dev": { + "bower-asset/qunit": "1.14.0", + "bower-asset/requirejs": "2.1.10", + "bower-asset/sinon": "1.8.1", + "bower-asset/sizzle": "2.1.1-patch2" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "dist/jquery.js", + "bower-asset-ignore": [ + "**/.*", + "build", + "dist/cdn", + "speed", + "test", + "*.md", + "AUTHORS.txt", + "Gruntfile.js", + "package.json" + ] + }, + "license": [ + "MIT" + ], + "keywords": [ + "javascript", + "jquery", + "library" + ] + }, + { + "name": "bower-asset/jquery.inputmask", + "version": "3.1.63", + "source": { + "type": "git", + "url": "https://github.com/RobinHerbots/jquery.inputmask.git", + "reference": "c40c7287eadc31e341ebbf0c02352eb55b9cbc48" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/RobinHerbots/jquery.inputmask/zipball/c40c7287eadc31e341ebbf0c02352eb55b9cbc48", + "reference": "c40c7287eadc31e341ebbf0c02352eb55b9cbc48", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.7" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": [ + "./dist/inputmask/jquery.inputmask.js", + "./dist/inputmask/jquery.inputmask.extensions.js", + "./dist/inputmask/jquery.inputmask.date.extensions.js", + "./dist/inputmask/jquery.inputmask.numeric.extensions.js", + "./dist/inputmask/jquery.inputmask.phone.extensions.js", + "./dist/inputmask/jquery.inputmask.regex.extensions.js" + ], + "bower-asset-ignore": [ + "**/.*", + "qunit/", + "nuget/", + "tools/", + "js/", + "*.md", + "build.properties", + "build.xml", + "jquery.inputmask.jquery.json" + ] + }, + "license": [ + "http://opensource.org/licenses/mit-license.php" + ], + "description": "jquery.inputmask is a jquery plugin which create an input mask.", + "keywords": [ + "form", + "input", + "inputmask", + "jquery", + "mask", + "plugins" + ] + }, + { + "name": "bower-asset/punycode", + "version": "v1.3.2", + "source": { + "type": "git", + "url": "https://github.com/bestiejs/punycode.js.git", + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bestiejs/punycode.js/zipball/38c8d3131a82567bfef18da09f7f4db68c84f8a3", + "reference": "38c8d3131a82567bfef18da09f7f4db68c84f8a3", + "shasum": "" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "punycode.js", + "bower-asset-ignore": [ + "coverage", + "tests", + ".*", + "component.json", + "Gruntfile.js", + "node_modules", + "package.json" + ] + } + }, + { + "name": "bower-asset/yii2-pjax", + "version": "v2.0.4", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/jquery-pjax.git", + "reference": "3f20897307cca046fca5323b318475ae9dac0ca0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/jquery-pjax/zipball/3f20897307cca046fca5323b318475ae9dac0ca0", + "reference": "3f20897307cca046fca5323b318475ae9dac0ca0", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.8" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "./jquery.pjax.js", + "bower-asset-ignore": [ + ".travis.yml", + "Gemfile", + "Gemfile.lock", + "vendor/", + "script/", + "test/" + ] + }, + "license": [ + "MIT" + ] + }, + { + "name": "cebe/markdown", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/cebe/markdown.git", + "reference": "54a2c49de31cc44e864ebf0500a35ef21d0010b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cebe/markdown/zipball/54a2c49de31cc44e864ebf0500a35ef21d0010b2", + "reference": "54a2c49de31cc44e864ebf0500a35ef21d0010b2", + "shasum": "" + }, + "require": { + "lib-pcre": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "cebe/indent": "*", + "facebook/xhprof": "*@dev", + "phpunit/phpunit": "4.1.*" + }, + "bin": [ + "bin/markdown" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "cebe\\markdown\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Carsten Brandt", + "email": "mail@cebe.cc", + "homepage": "http://cebe.cc/", + "role": "Creator" + } + ], + "description": "A super fast, highly extensible markdown parser for PHP", + "homepage": "https://github.com/cebe/markdown#readme", + "keywords": [ + "extensible", + "fast", + "gfm", + "markdown", + "markdown-extra" + ], + "time": "2015-03-06 05:28:07" + }, + { + "name": "ezyang/htmlpurifier", + "version": "v4.6.0", + "source": { + "type": "git", + "url": "https://github.com/ezyang/htmlpurifier.git", + "reference": "6f389f0f25b90d0b495308efcfa073981177f0fd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/6f389f0f25b90d0b495308efcfa073981177f0fd", + "reference": "6f389f0f25b90d0b495308efcfa073981177f0fd", + "shasum": "" + }, + "require": { + "php": ">=5.2" + }, + "type": "library", + "autoload": { + "psr-0": { + "HTMLPurifier": "library/" + }, + "files": [ + "library/HTMLPurifier.composer.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL" + ], + "authors": [ + { + "name": "Edward Z. Yang", + "email": "admin@htmlpurifier.org", + "homepage": "http://ezyang.com/" + } + ], + "description": "Standards compliant HTML filter written in PHP", + "homepage": "http://htmlpurifier.org/", + "keywords": [ + "html" + ], + "time": "2013-11-30 08:25:19" + }, + { + "name": "swiftmailer/swiftmailer", + "version": "v5.4.1", + "source": { + "type": "git", + "url": "https://github.com/swiftmailer/swiftmailer.git", + "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/0697e6aa65c83edf97bb0f23d8763f94e3f11421", + "reference": "0697e6aa65c83edf97bb0f23d8763f94e3f11421", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "mockery/mockery": "~0.9.1,<0.9.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.4-dev" + } + }, + "autoload": { + "files": [ + "lib/swift_required.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Chris Corbyn" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Swiftmailer, free feature-rich PHP mailer", + "homepage": "http://swiftmailer.org/", + "keywords": [ + "email", + "mail", + "mailer" + ], + "time": "2015-06-06 14:19:39" + }, + { + "name": "yiisoft/yii2", + "version": "2.0.6", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-framework.git", + "reference": "f42b2eb80f61992438661b01d0d74c6738e2ff38" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-framework/zipball/f42b2eb80f61992438661b01d0d74c6738e2ff38", + "reference": "f42b2eb80f61992438661b01d0d74c6738e2ff38", + "shasum": "" + }, + "require": { + "bower-asset/jquery": "2.1.*@stable | 1.11.*@stable", + "bower-asset/jquery.inputmask": "3.1.*", + "bower-asset/punycode": "1.3.*", + "bower-asset/yii2-pjax": ">=2.0.1", + "cebe/markdown": "~1.0.0 | ~1.1.0", + "ext-mbstring": "*", + "ezyang/htmlpurifier": "4.6.*", + "lib-pcre": "*", + "php": ">=5.4.0", + "yiisoft/yii2-composer": "*" + }, + "bin": [ + "yii" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com", + "homepage": "http://www.yiiframework.com/", + "role": "Founder and project lead" + }, + { + "name": "Alexander Makarov", + "email": "sam@rmcreative.ru", + "homepage": "http://rmcreative.ru/", + "role": "Core framework development" + }, + { + "name": "Maurizio Domba", + "homepage": "http://mdomba.info/", + "role": "Core framework development" + }, + { + "name": "Carsten Brandt", + "email": "mail@cebe.cc", + "homepage": "http://cebe.cc/", + "role": "Core framework development" + }, + { + "name": "Timur Ruziev", + "email": "resurtm@gmail.com", + "homepage": "http://resurtm.com/", + "role": "Core framework development" + }, + { + "name": "Paul Klimov", + "email": "klimov.paul@gmail.com", + "role": "Core framework development" + } + ], + "description": "Yii PHP Framework Version 2", + "homepage": "http://www.yiiframework.com/", + "keywords": [ + "framework", + "yii2" + ], + "time": "2015-08-05 22:00:30" + }, + { + "name": "yiisoft/yii2-composer", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-composer.git", + "reference": "ca8d23707ae47d20b0454e4b135c156f6da6d7be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-composer/zipball/ca8d23707ae47d20b0454e4b135c156f6da6d7be", + "reference": "ca8d23707ae47d20b0454e4b135c156f6da6d7be", + "shasum": "" + }, + "require": { + "composer-plugin-api": "1.0.0" + }, + "type": "composer-plugin", + "extra": { + "class": "yii\\composer\\Plugin", + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\composer\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + } + ], + "description": "The composer plugin for Yii extension installer", + "keywords": [ + "composer", + "extension installer", + "yii2" + ], + "time": "2015-03-01 06:22:44" + }, + { + "name": "yiisoft/yii2-httpclient", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-httpclient.git", + "reference": "46d10b533ee05d7ed76e757d7ecfdcbac2b7d346" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-httpclient/zipball/46d10b533ee05d7ed76e757d7ecfdcbac2b7d346", + "reference": "46d10b533ee05d7ed76e757d7ecfdcbac2b7d346", + "shasum": "" + }, + "require": { + "yiisoft/yii2": "*" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\httpclient\\": "" + } + }, + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Paul Klimov", + "email": "klimov.paul@gmail.com" + } + ], + "description": "HTTP client extension for the Yii framework", + "keywords": [ + "curl", + "http", + "httpclient", + "yii2" + ], + "support": { + "issues": "https://github.com/yiisoft/yii2-httpclient/issues", + "forum": "http://www.yiiframework.com/forum/", + "wiki": "http://www.yiiframework.com/wiki/", + "irc": "irc://irc.freenode.net/yii", + "source": "https://github.com/yiisoft/yii2-httpclient" + }, + "time": "2015-09-09 10:42:06" + }, + { + "name": "yiisoft/yii2-swiftmailer", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-swiftmailer.git", + "reference": "4ec435a89e30b203cea99770910fb5499cb3627a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-swiftmailer/zipball/4ec435a89e30b203cea99770910fb5499cb3627a", + "reference": "4ec435a89e30b203cea99770910fb5499cb3627a", + "shasum": "" + }, + "require": { + "swiftmailer/swiftmailer": "~5.0", + "yiisoft/yii2": ">=2.0.4" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\swiftmailer\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Paul Klimov", + "email": "klimov.paul@gmail.com" + } + ], + "description": "The SwiftMailer integration for the Yii framework", + "keywords": [ + "email", + "mail", + "mailer", + "swift", + "swiftmailer", + "yii2" + ], + "time": "2015-05-10 22:12:32" + } + ], + "packages-dev": [ + { + "name": "bower-asset/typeahead.js", + "version": "v0.10.5", + "source": { + "type": "git", + "url": "https://github.com/twitter/typeahead.js.git", + "reference": "5f198b87d1af845da502ea9df93a5e84801ce742" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twitter/typeahead.js/zipball/5f198b87d1af845da502ea9df93a5e84801ce742", + "reference": "5f198b87d1af845da502ea9df93a5e84801ce742", + "shasum": "" + }, + "require": { + "bower-asset/jquery": ">=1.7" + }, + "require-dev": { + "bower-asset/jasmine-ajax": "~1.3.1", + "bower-asset/jasmine-jquery": "~1.5.2", + "bower-asset/jquery": "~1.7" + }, + "type": "bower-asset-library", + "extra": { + "bower-asset-main": "dist/typeahead.bundle.js" + } + }, + { + "name": "cando/yii2-db", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/CanDo-com/yii2-db.git", + "reference": "b939f26254d853068219e394e2cc71d89aadd033" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/CanDo-com/yii2-db/zipball/b939f26254d853068219e394e2cc71d89aadd033", + "reference": "b939f26254d853068219e394e2cc71d89aadd033", + "shasum": "" + }, + "require-dev": { + "yiisoft/yii2": ">=2.0.6", + "yiisoft/yii2-gii": "*" + }, + "type": "library", + "autoload": { + "psr-4": { + "cando\\database\\": "" + } + }, + "authors": [ + { + "name": "Sergiy Misyura", + "email": "sergiy@cando.com" + } + ], + "description": "Database-related helpers for Yii2 framework", + "keywords": [ + "database", + "yii2" + ], + "support": { + "source": "https://github.com/CanDo-com/yii2-db/tree/master", + "issues": "https://github.com/CanDo-com/yii2-db/issues" + }, + "time": "2015-10-06 19:51:40" + }, + { + "name": "fzaninotto/faker", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/fzaninotto/Faker.git", + "reference": "d0190b156bcca848d401fb80f31f504f37141c8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/fzaninotto/Faker/zipball/d0190b156bcca848d401fb80f31f504f37141c8d", + "reference": "d0190b156bcca848d401fb80f31f504f37141c8d", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~1.5" + }, + "suggest": { + "ext-intl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5.x-dev" + } + }, + "autoload": { + "psr-4": { + "Faker\\": "src/Faker/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "François Zaninotto" + } + ], + "description": "Faker is a PHP library that generates fake data for you.", + "keywords": [ + "data", + "faker", + "fixtures" + ], + "time": "2015-05-29 06:29:14" + }, + { + "name": "packagist/closurecompiler-bin", + "version": "v2015.05.05", + "source": { + "type": "git", + "url": "https://github.com/packagist/closurecompiler-bin.git", + "reference": "d52231c49813347010fa605d0f102ada68bb8b4b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/packagist/closurecompiler-bin/zipball/d52231c49813347010fa605d0f102ada68bb8b4b", + "reference": "d52231c49813347010fa605d0f102ada68bb8b4b", + "shasum": "" + }, + "bin": [ + "bin/compiler.jar" + ], + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Google Inc.", + "homepage": "https://developers.google.com/closure/compiler/" + }, + { + "name": "Package Maintainer", + "email": "kaiwa@20minutemail.com", + "role": "maintainer" + } + ], + "description": "The Closure Compiler is a tool for making JavaScript download and run faster. It is a true compiler for JavaScript. Instead of compiling from a source language to machine code, it compiles from JavaScript to better JavaScript. It parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes what's left. It also checks syntax, variable references, and types, and warns about common JavaScript pitfalls. Packaged for composer.", + "keywords": [ + "binary", + "closure", + "compiler", + "compress", + "google", + "javascript", + "minification", + "minify" + ], + "time": "2015-05-20 13:38:08" + }, + { + "name": "phpspec/php-diff", + "version": "v1.0.2", + "source": { + "type": "git", + "url": "https://github.com/phpspec/php-diff.git", + "reference": "30e103d19519fe678ae64a60d77884ef3d71b28a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/php-diff/zipball/30e103d19519fe678ae64a60d77884ef3d71b28a", + "reference": "30e103d19519fe678ae64a60d77884ef3d71b28a", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "Diff": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Chris Boulton", + "homepage": "http://github.com/chrisboulton", + "role": "Original developer" + } + ], + "description": "A comprehensive library for generating differences between two hashable objects (strings or arrays).", + "time": "2013-11-01 13:02:21" + }, + { + "name": "yiisoft/yii2-bootstrap", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-bootstrap.git", + "reference": "1464f93834b1d5edb1f5625f7ffd6c3723fa4923" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-bootstrap/zipball/1464f93834b1d5edb1f5625f7ffd6c3723fa4923", + "reference": "1464f93834b1d5edb1f5625f7ffd6c3723fa4923", + "shasum": "" + }, + "require": { + "bower-asset/bootstrap": "3.3.* | 3.2.* | 3.1.*", + "yiisoft/yii2": ">=2.0.6" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + }, + "asset-installer-paths": { + "npm-asset-library": "vendor/npm", + "bower-asset-library": "vendor/bower" + } + }, + "autoload": { + "psr-4": { + "yii\\bootstrap\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + } + ], + "description": "The Twitter Bootstrap extension for the Yii framework", + "keywords": [ + "bootstrap", + "yii2" + ], + "time": "2015-09-23 17:48:24" + }, + { + "name": "yiisoft/yii2-codeception", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-codeception.git", + "reference": "de5007e7a99359597abbfe1c88dca3ce620061c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-codeception/zipball/de5007e7a99359597abbfe1c88dca3ce620061c5", + "reference": "de5007e7a99359597abbfe1c88dca3ce620061c5", + "shasum": "" + }, + "require": { + "yiisoft/yii2": ">=2.0.4" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\codeception\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Mark Jebri", + "email": "mark.github@yandex.ru" + } + ], + "description": "The Codeception integration for the Yii framework", + "keywords": [ + "codeception", + "yii2" + ], + "time": "2015-05-10 22:08:30" + }, + { + "name": "yiisoft/yii2-debug", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-debug.git", + "reference": "1b302e67521d46feb2413d9d96ca94ed82b39b0e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-debug/zipball/1b302e67521d46feb2413d9d96ca94ed82b39b0e", + "reference": "1b302e67521d46feb2413d9d96ca94ed82b39b0e", + "shasum": "" + }, + "require": { + "yiisoft/yii2": ">=2.0.4", + "yiisoft/yii2-bootstrap": "*" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\debug\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + } + ], + "description": "The debugger extension for the Yii framework", + "keywords": [ + "debug", + "debugger", + "yii2" + ], + "time": "2015-08-06 16:14:06" + }, + { + "name": "yiisoft/yii2-faker", + "version": "2.0.3", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-faker.git", + "reference": "b88ca69ee226a3610b2c26c026c3203d7ac50f6c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-faker/zipball/b88ca69ee226a3610b2c26c026c3203d7ac50f6c", + "reference": "b88ca69ee226a3610b2c26c026c3203d7ac50f6c", + "shasum": "" + }, + "require": { + "fzaninotto/faker": "*", + "yiisoft/yii2": "*" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "yii\\faker\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Mark Jebri", + "email": "mark.github@yandex.ru" + } + ], + "description": "Fixture generator. The Faker integration for the Yii framework.", + "keywords": [ + "Fixture", + "faker", + "yii2" + ], + "time": "2015-03-01 06:22:44" + }, + { + "name": "yiisoft/yii2-gii", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/yiisoft/yii2-gii.git", + "reference": "e5a023e8779bd774194842ec1b8fb4917cf04007" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/yiisoft/yii2-gii/zipball/e5a023e8779bd774194842ec1b8fb4917cf04007", + "reference": "e5a023e8779bd774194842ec1b8fb4917cf04007", + "shasum": "" + }, + "require": { + "bower-asset/typeahead.js": "0.10.*", + "phpspec/php-diff": ">=1.0.2", + "yiisoft/yii2": ">=2.0.4", + "yiisoft/yii2-bootstrap": "~2.0" + }, + "type": "yii2-extension", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + }, + "asset-installer-paths": { + "npm-asset-library": "vendor/npm", + "bower-asset-library": "vendor/bower" + } + }, + "autoload": { + "psr-4": { + "yii\\gii\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Qiang Xue", + "email": "qiang.xue@gmail.com" + } + ], + "description": "The Gii extension for the Yii framework", + "keywords": [ + "code generator", + "gii", + "yii2" + ], + "time": "2015-05-10 22:09:31" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "yiisoft/yii2-httpclient": 20, + "cando/yii2-db": 20 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.5.0" + }, + "platform-dev": [] +} diff --git a/config/db.php b/config/db.php.dist similarity index 70% rename from config/db.php rename to config/db.php.dist index c4c12529c..ad19af2d1 100644 --- a/config/db.php +++ b/config/db.php.dist @@ -2,7 +2,7 @@ return [ 'class' => 'yii\db\Connection', - 'dsn' => 'mysql:host=localhost;dbname=yii2basic', + 'dsn' => 'mysql:host=localhost;dbname=', 'username' => 'root', 'password' => '', 'charset' => 'utf8', diff --git a/config/env.php.debug b/config/env.php.debug new file mode 100644 index 000000000..13bd4557d --- /dev/null +++ b/config/env.php.debug @@ -0,0 +1,4 @@ + 'admin@example.com', ]; diff --git a/config/routes.php b/config/routes.php new file mode 100644 index 000000000..b62512838 --- /dev/null +++ b/config/routes.php @@ -0,0 +1,4 @@ + ['log'], 'components' => [ 'request' => [ - // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation - 'cookieValidationKey' => '', - ], - 'cache' => [ - 'class' => 'yii\caching\FileCache', - ], - 'user' => [ - 'identityClass' => 'app\models\User', - 'enableAutoLogin' => true, + 'enableCookieValidation' => false, + 'enableCsrfValidation' => false, ], 'errorHandler' => [ 'errorAction' => 'site/error', ], - 'mailer' => [ - 'class' => 'yii\swiftmailer\Mailer', - // send all mails to a file by default. You have to set - // 'useFileTransport' to false and configure a transport - // for the mailer to send real emails. - 'useFileTransport' => true, - ], 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, 'targets' => [ @@ -38,15 +24,25 @@ ], ], 'db' => require(__DIR__ . '/db.php'), - /* 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, - 'rules' => [ - ], + 'rules' => require(__DIR__ . '/routes.php'), ], - */ - ], + 'assetManager' => [ + 'converter' => [ + 'class' => 'yii\web\AssetConverter', + 'commands' => [ + 'less' => [ + 'css', + 'lessc {from} {to} --no-color' + ], + ], + 'forceConvert' => true, + ], + 'forceCopy' => true, + ], + ], 'params' => $params, ]; @@ -56,11 +52,6 @@ $config['modules']['debug'] = [ 'class' => 'yii\debug\Module', ]; - - $config['bootstrap'][] = 'gii'; - $config['modules']['gii'] = [ - 'class' => 'yii\gii\Module', - ]; } return $config; diff --git a/controllers/SiteController.php b/controllers/SiteController.php index 4ffba24cb..a0316641b 100644 --- a/controllers/SiteController.php +++ b/controllers/SiteController.php @@ -2,93 +2,12 @@ namespace app\controllers; -use Yii; -use yii\filters\AccessControl; use yii\web\Controller; -use yii\filters\VerbFilter; -use app\models\LoginForm; -use app\models\ContactForm; class SiteController extends Controller { - public function behaviors() - { - return [ - 'access' => [ - 'class' => AccessControl::className(), - 'only' => ['logout'], - 'rules' => [ - [ - 'actions' => ['logout'], - 'allow' => true, - 'roles' => ['@'], - ], - ], - ], - 'verbs' => [ - 'class' => VerbFilter::className(), - 'actions' => [ - 'logout' => ['post'], - ], - ], - ]; - } - - public function actions() - { - return [ - 'error' => [ - 'class' => 'yii\web\ErrorAction', - ], - 'captcha' => [ - 'class' => 'yii\captcha\CaptchaAction', - 'fixedVerifyCode' => YII_ENV_TEST ? 'testme' : null, - ], - ]; - } - - public function actionIndex() - { - return $this->render('index'); - } - - public function actionLogin() - { - if (!\Yii::$app->user->isGuest) { - return $this->goHome(); - } - - $model = new LoginForm(); - if ($model->load(Yii::$app->request->post()) && $model->login()) { - return $this->goBack(); - } - return $this->render('login', [ - 'model' => $model, - ]); - } - - public function actionLogout() - { - Yii::$app->user->logout(); - - return $this->goHome(); - } - - public function actionContact() - { - $model = new ContactForm(); - if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) { - Yii::$app->session->setFlash('contactFormSubmitted'); - - return $this->refresh(); - } - return $this->render('contact', [ - 'model' => $model, - ]); - } - - public function actionAbout() - { - return $this->render('about'); - } + public function actionIndex() + { + return $this->render('index'); + } } diff --git a/files/less/application.less b/files/less/application.less new file mode 100644 index 000000000..a5bad76c8 --- /dev/null +++ b/files/less/application.less @@ -0,0 +1,3 @@ + +@import "http://github.com/vendor/bower/bootstrap/less/bootstrap.less"; + diff --git a/mail/layouts/html.php b/mail/layouts/html.php deleted file mode 100644 index bddbc6129..000000000 --- a/mail/layouts/html.php +++ /dev/null @@ -1,22 +0,0 @@ - -beginPage() ?> - - - - - <?= Html::encode($this->title) ?> - head() ?> - - - beginBody() ?> - - endBody() ?> - - -endPage() ?> diff --git a/models/ContactForm.php b/models/ContactForm.php deleted file mode 100644 index 361b80b39..000000000 --- a/models/ContactForm.php +++ /dev/null @@ -1,63 +0,0 @@ - 'Verification Code', - ]; - } - - /** - * Sends an email to the specified email address using the information collected by this model. - * @param string $email the target email address - * @return boolean whether the model passes validation - */ - public function contact($email) - { - if ($this->validate()) { - Yii::$app->mailer->compose() - ->setTo($email) - ->setFrom([$this->email => $this->name]) - ->setSubject($this->subject) - ->setTextBody($this->body) - ->send(); - - return true; - } - return false; - } -} diff --git a/models/LoginForm.php b/models/LoginForm.php deleted file mode 100644 index 227168cf6..000000000 --- a/models/LoginForm.php +++ /dev/null @@ -1,78 +0,0 @@ -hasErrors()) { - $user = $this->getUser(); - - if (!$user || !$user->validatePassword($this->password)) { - $this->addError($attribute, 'Incorrect username or password.'); - } - } - } - - /** - * Logs in a user using the provided username and password. - * @return boolean whether the user is logged in successfully - */ - public function login() - { - if ($this->validate()) { - return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0); - } - return false; - } - - /** - * Finds user by [[username]] - * - * @return User|null - */ - public function getUser() - { - if ($this->_user === false) { - $this->_user = User::findByUsername($this->username); - } - - return $this->_user; - } -} diff --git a/models/User.php b/models/User.php deleted file mode 100644 index cbfb9fefc..000000000 --- a/models/User.php +++ /dev/null @@ -1,103 +0,0 @@ - [ - 'id' => '100', - 'username' => 'admin', - 'password' => 'admin', - 'authKey' => 'test100key', - 'accessToken' => '100-token', - ], - '101' => [ - 'id' => '101', - 'username' => 'demo', - 'password' => 'demo', - 'authKey' => 'test101key', - 'accessToken' => '101-token', - ], - ]; - - /** - * @inheritdoc - */ - public static function findIdentity($id) - { - return isset(self::$users[$id]) ? new static(self::$users[$id]) : null; - } - - /** - * @inheritdoc - */ - public static function findIdentityByAccessToken($token, $type = null) - { - foreach (self::$users as $user) { - if ($user['accessToken'] === $token) { - return new static($user); - } - } - - return null; - } - - /** - * Finds user by username - * - * @param string $username - * @return static|null - */ - public static function findByUsername($username) - { - foreach (self::$users as $user) { - if (strcasecmp($user['username'], $username) === 0) { - return new static($user); - } - } - - return null; - } - - /** - * @inheritdoc - */ - public function getId() - { - return $this->id; - } - - /** - * @inheritdoc - */ - public function getAuthKey() - { - return $this->authKey; - } - - /** - * @inheritdoc - */ - public function validateAuthKey($authKey) - { - return $this->authKey === $authKey; - } - - /** - * Validates password - * - * @param string $password password to validate - * @return boolean if password provided is valid for current user - */ - public function validatePassword($password) - { - return $this->password === $password; - } -} diff --git a/tests/codeception/_pages/AboutPage.php b/tests/codeception/_pages/AboutPage.php deleted file mode 100644 index b56320d09..000000000 --- a/tests/codeception/_pages/AboutPage.php +++ /dev/null @@ -1,14 +0,0 @@ - $value) { - $inputType = $field === 'body' ? 'textarea' : 'input'; - $this->actor->fillField($inputType . '[name="ContactForm[' . $field . ']"]', $value); - } - $this->actor->click('contact-button'); - } -} diff --git a/tests/codeception/_pages/LoginPage.php b/tests/codeception/_pages/LoginPage.php deleted file mode 100644 index c3a2ef2dd..000000000 --- a/tests/codeception/_pages/LoginPage.php +++ /dev/null @@ -1,25 +0,0 @@ -actor->fillField('input[name="LoginForm[username]"]', $username); - $this->actor->fillField('input[name="LoginForm[password]"]', $password); - $this->actor->click('login-button'); - } -} diff --git a/tests/codeception/acceptance/AboutCept.php b/tests/codeception/acceptance/AboutCept.php deleted file mode 100644 index 88a550698..000000000 --- a/tests/codeception/acceptance/AboutCept.php +++ /dev/null @@ -1,10 +0,0 @@ -wantTo('ensure that about works'); -AboutPage::openBy($I); -$I->see('About', 'h1'); diff --git a/tests/codeception/acceptance/ContactCept.php b/tests/codeception/acceptance/ContactCept.php deleted file mode 100644 index b51d1c085..000000000 --- a/tests/codeception/acceptance/ContactCept.php +++ /dev/null @@ -1,57 +0,0 @@ -wantTo('ensure that contact works'); - -$contactPage = ContactPage::openBy($I); - -$I->see('Contact', 'h1'); - -$I->amGoingTo('submit contact form with no data'); -$contactPage->submit([]); -if (method_exists($I, 'wait')) { - $I->wait(3); // only for selenium -} -$I->expectTo('see validations errors'); -$I->see('Contact', 'h1'); -$I->see('Name cannot be blank'); -$I->see('Email cannot be blank'); -$I->see('Subject cannot be blank'); -$I->see('Body cannot be blank'); -$I->see('The verification code is incorrect'); - -$I->amGoingTo('submit contact form with not correct email'); -$contactPage->submit([ - 'name' => 'tester', - 'email' => 'tester.email', - 'subject' => 'test subject', - 'body' => 'test content', - 'verifyCode' => 'testme', -]); -if (method_exists($I, 'wait')) { - $I->wait(3); // only for selenium -} -$I->expectTo('see that email adress is wrong'); -$I->dontSee('Name cannot be blank', '.help-inline'); -$I->see('Email is not a valid email address.'); -$I->dontSee('Subject cannot be blank', '.help-inline'); -$I->dontSee('Body cannot be blank', '.help-inline'); -$I->dontSee('The verification code is incorrect', '.help-inline'); - -$I->amGoingTo('submit contact form with correct data'); -$contactPage->submit([ - 'name' => 'tester', - 'email' => 'tester@example.com', - 'subject' => 'test subject', - 'body' => 'test content', - 'verifyCode' => 'testme', -]); -if (method_exists($I, 'wait')) { - $I->wait(3); // only for selenium -} -$I->dontSeeElement('#contact-form'); -$I->see('Thank you for contacting us. We will respond to you as soon as possible.'); diff --git a/tests/codeception/acceptance/HomeCept.php b/tests/codeception/acceptance/HomeCept.php deleted file mode 100644 index 1f9353595..000000000 --- a/tests/codeception/acceptance/HomeCept.php +++ /dev/null @@ -1,11 +0,0 @@ -wantTo('ensure that home page works'); -$I->amOnPage(Yii::$app->homeUrl); -$I->see('My Company'); -$I->seeLink('About'); -$I->click('About'); -$I->see('This is the About page.'); diff --git a/tests/codeception/acceptance/LoginCept.php b/tests/codeception/acceptance/LoginCept.php deleted file mode 100644 index 90d063583..000000000 --- a/tests/codeception/acceptance/LoginCept.php +++ /dev/null @@ -1,37 +0,0 @@ -wantTo('ensure that login works'); - -$loginPage = LoginPage::openBy($I); - -$I->see('Login', 'h1'); - -$I->amGoingTo('try to login with empty credentials'); -$loginPage->login('', ''); -if (method_exists($I, 'wait')) { - $I->wait(3); // only for selenium -} -$I->expectTo('see validations errors'); -$I->see('Username cannot be blank.'); -$I->see('Password cannot be blank.'); - -$I->amGoingTo('try to login with wrong credentials'); -$loginPage->login('admin', 'wrong'); -if (method_exists($I, 'wait')) { - $I->wait(3); // only for selenium -} -$I->expectTo('see validations errors'); -$I->see('Incorrect username or password.'); - -$I->amGoingTo('try to login with correct credentials'); -$loginPage->login('admin', 'admin'); -if (method_exists($I, 'wait')) { - $I->wait(3); // only for selenium -} -$I->expectTo('see user info'); -$I->see('Logout (admin)'); diff --git a/tests/codeception/functional/AboutCept.php b/tests/codeception/functional/AboutCept.php deleted file mode 100644 index 09260612f..000000000 --- a/tests/codeception/functional/AboutCept.php +++ /dev/null @@ -1,10 +0,0 @@ -wantTo('ensure that about works'); -AboutPage::openBy($I); -$I->see('About', 'h1'); diff --git a/tests/codeception/functional/ContactCept.php b/tests/codeception/functional/ContactCept.php deleted file mode 100644 index 074820a70..000000000 --- a/tests/codeception/functional/ContactCept.php +++ /dev/null @@ -1,48 +0,0 @@ -wantTo('ensure that contact works'); - -$contactPage = ContactPage::openBy($I); - -$I->see('Contact', 'h1'); - -$I->amGoingTo('submit contact form with no data'); -$contactPage->submit([]); -$I->expectTo('see validations errors'); -$I->see('Contact', 'h1'); -$I->see('Name cannot be blank'); -$I->see('Email cannot be blank'); -$I->see('Subject cannot be blank'); -$I->see('Body cannot be blank'); -$I->see('The verification code is incorrect'); - -$I->amGoingTo('submit contact form with not correct email'); -$contactPage->submit([ - 'name' => 'tester', - 'email' => 'tester.email', - 'subject' => 'test subject', - 'body' => 'test content', - 'verifyCode' => 'testme', -]); -$I->expectTo('see that email adress is wrong'); -$I->dontSee('Name cannot be blank', '.help-inline'); -$I->see('Email is not a valid email address.'); -$I->dontSee('Subject cannot be blank', '.help-inline'); -$I->dontSee('Body cannot be blank', '.help-inline'); -$I->dontSee('The verification code is incorrect', '.help-inline'); - -$I->amGoingTo('submit contact form with correct data'); -$contactPage->submit([ - 'name' => 'tester', - 'email' => 'tester@example.com', - 'subject' => 'test subject', - 'body' => 'test content', - 'verifyCode' => 'testme', -]); -$I->dontSeeElement('#contact-form'); -$I->see('Thank you for contacting us. We will respond to you as soon as possible.'); diff --git a/tests/codeception/functional/HomeCept.php b/tests/codeception/functional/HomeCept.php deleted file mode 100644 index 94efb09cd..000000000 --- a/tests/codeception/functional/HomeCept.php +++ /dev/null @@ -1,11 +0,0 @@ -wantTo('ensure that home page works'); -$I->amOnPage(Yii::$app->homeUrl); -$I->see('My Company'); -$I->seeLink('About'); -$I->click('About'); -$I->see('This is the About page.'); diff --git a/tests/codeception/functional/LoginCept.php b/tests/codeception/functional/LoginCept.php deleted file mode 100644 index 66e760989..000000000 --- a/tests/codeception/functional/LoginCept.php +++ /dev/null @@ -1,28 +0,0 @@ -wantTo('ensure that login works'); - -$loginPage = LoginPage::openBy($I); - -$I->see('Login', 'h1'); - -$I->amGoingTo('try to login with empty credentials'); -$loginPage->login('', ''); -$I->expectTo('see validations errors'); -$I->see('Username cannot be blank.'); -$I->see('Password cannot be blank.'); - -$I->amGoingTo('try to login with wrong credentials'); -$loginPage->login('admin', 'wrong'); -$I->expectTo('see validations errors'); -$I->see('Incorrect username or password.'); - -$I->amGoingTo('try to login with correct credentials'); -$loginPage->login('admin', 'admin'); -$I->expectTo('see user info'); -$I->see('Logout (admin)'); diff --git a/tests/codeception/unit/models/ContactFormTest.php b/tests/codeception/unit/models/ContactFormTest.php deleted file mode 100644 index 323482943..000000000 --- a/tests/codeception/unit/models/ContactFormTest.php +++ /dev/null @@ -1,60 +0,0 @@ -mailer->fileTransportCallback = function ($mailer, $message) { - return 'testing_message.eml'; - }; - } - - protected function tearDown() - { - unlink($this->getMessageFile()); - parent::tearDown(); - } - - public function testContact() - { - $model = $this->getMock('app\models\ContactForm', ['validate']); - $model->expects($this->once())->method('validate')->will($this->returnValue(true)); - - $model->attributes = [ - 'name' => 'Tester', - 'email' => 'tester@example.com', - 'subject' => 'very important letter subject', - 'body' => 'body of current message', - ]; - - $model->contact('admin@example.com'); - - $this->specify('email should be send', function () { - expect('email file should exist', file_exists($this->getMessageFile()))->true(); - }); - - $this->specify('message should contain correct data', function () use ($model) { - $emailMessage = file_get_contents($this->getMessageFile()); - - expect('email should contain user name', $emailMessage)->contains($model->name); - expect('email should contain sender email', $emailMessage)->contains($model->email); - expect('email should contain subject', $emailMessage)->contains($model->subject); - expect('email should contain body', $emailMessage)->contains($model->body); - }); - } - - private function getMessageFile() - { - return Yii::getAlias(Yii::$app->mailer->fileTransportPath) . '/testing_message.eml'; - } - -} diff --git a/tests/codeception/unit/models/LoginFormTest.php b/tests/codeception/unit/models/LoginFormTest.php deleted file mode 100644 index c7f971a06..000000000 --- a/tests/codeception/unit/models/LoginFormTest.php +++ /dev/null @@ -1,61 +0,0 @@ -user->logout(); - parent::tearDown(); - } - - public function testLoginNoUser() - { - $model = new LoginForm([ - 'username' => 'not_existing_username', - 'password' => 'not_existing_password', - ]); - - $this->specify('user should not be able to login, when there is no identity', function () use ($model) { - expect('model should not login user', $model->login())->false(); - expect('user should not be logged in', Yii::$app->user->isGuest)->true(); - }); - } - - public function testLoginWrongPassword() - { - $model = new LoginForm([ - 'username' => 'demo', - 'password' => 'wrong_password', - ]); - - $this->specify('user should not be able to login with wrong password', function () use ($model) { - expect('model should not login user', $model->login())->false(); - expect('error message should be set', $model->errors)->hasKey('password'); - expect('user should not be logged in', Yii::$app->user->isGuest)->true(); - }); - } - - public function testLoginCorrect() - { - $model = new LoginForm([ - 'username' => 'demo', - 'password' => 'demo', - ]); - - $this->specify('user should be able to login with correct credentials', function () use ($model) { - expect('model should login user', $model->login())->true(); - expect('error message should not be set', $model->errors)->hasntKey('password'); - expect('user should be logged in', Yii::$app->user->isGuest)->false(); - }); - } - -} diff --git a/tests/codeception/unit/models/UserTest.php b/tests/codeception/unit/models/UserTest.php deleted file mode 100644 index f4f4f4bb9..000000000 --- a/tests/codeception/unit/models/UserTest.php +++ /dev/null @@ -1,17 +0,0 @@ -loadFixtures(['user']); - } - - // TODO add test methods here -} diff --git a/vagrant/config-mysql.sh b/vagrant/config-mysql.sh new file mode 100644 index 000000000..0247be93e --- /dev/null +++ b/vagrant/config-mysql.sh @@ -0,0 +1,5 @@ +rm /etc/mysql/my.cnf +cp /vagrant/vagrant/config/mysql.conf /etc/mysql/my.cnf +chmod 0644 /etc/mysql/my.cnf + +service mysql restart diff --git a/vagrant/config-postgre.sh b/vagrant/config-postgre.sh new file mode 100644 index 000000000..250b9a37e --- /dev/null +++ b/vagrant/config-postgre.sh @@ -0,0 +1,2 @@ +echo "create role dev login password 'devdb'" | sudo -u postgres psql +echo "create database dev" | sudo -u postgres psql \ No newline at end of file diff --git a/vagrant/config-project.sh b/vagrant/config-project.sh new file mode 100644 index 000000000..3755ea9ff --- /dev/null +++ b/vagrant/config-project.sh @@ -0,0 +1,2 @@ + +# Project-specific configuration script. diff --git a/vagrant/config.sh b/vagrant/config.sh new file mode 100644 index 000000000..364a8c8ea --- /dev/null +++ b/vagrant/config.sh @@ -0,0 +1,30 @@ + +rm -rf /var/www +ln -s /vagrant/web /var/www + +ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load + +rm /etc/apache2/sites-enabled/000-default.conf +cp /vagrant/vagrant/config/apache-site.conf /etc/apache2/sites-enabled/000-default.conf + +# set the apache run user to vagrant to avoid permission issues +sed -i 's/APACHE_RUN_USER=www-data/APACHE_RUN_USER=vagrant/' /etc/apache2/envvars +sed -i 's/APACHE_RUN_GROUP=www-data/APACHE_RUN_GROUP=vagrant/' /etc/apache2/envvars + +# "hard" restart, forces the user change +apache2ctl stop +while pgrep apache2 &>/dev/null; do sleep 0.1; done +apache2ctl start + +dos2unix /vagrant/vagrant/config/.bash_once +dos2unix /vagrant/vagrant/config/bashrc +dos2unix /vagrant/vagrant/user.sh + +cp /vagrant/vagrant/config/.bash_once /home/vagrant/ +chown vagrant:vagrant /home/vagrant/.bash_once +chmod u+x /home/vagrant/.bash_once + +cat /vagrant/vagrant/config/bashrc >> /home/vagrant/.bashrc + +# set the environment into DEBUG mode +cp /vagrant/config/env.php.debug /vagrant/config/env.php diff --git a/vagrant/config/.bash_once b/vagrant/config/.bash_once new file mode 100644 index 000000000..980be2e5d --- /dev/null +++ b/vagrant/config/.bash_once @@ -0,0 +1,2 @@ +/vagrant/vagrant/user.sh +rm ~/.bash_once diff --git a/vagrant/config/apache-site.conf b/vagrant/config/apache-site.conf new file mode 100644 index 000000000..da2a12db8 --- /dev/null +++ b/vagrant/config/apache-site.conf @@ -0,0 +1,13 @@ + + ServerAdmin webmaster@localhost + + DocumentRoot /var/www + ErrorLog /vagrant/.vagrant/error.log + CustomLog /vagrant/.vagrant/access.log combined + + + Options Indexes FollowSymLinks + AllowOverride all + Require all granted + + diff --git a/vagrant/config/bashrc b/vagrant/config/bashrc new file mode 100644 index 000000000..3859a0b43 --- /dev/null +++ b/vagrant/config/bashrc @@ -0,0 +1,5 @@ +if [ -f ~/.bash_once ]; then + . ~/.bash_once +fi + +PATH="$HOME/.composer/vendor/bin:$PATH" diff --git a/vagrant/config/mysql.conf b/vagrant/config/mysql.conf new file mode 100644 index 000000000..62f5876b4 --- /dev/null +++ b/vagrant/config/mysql.conf @@ -0,0 +1,127 @@ +# +# The MySQL database server configuration file. +# +# You can copy this to one of: +# - "/etc/mysql/my.cnf" to set global options, +# - "~/.my.cnf" to set user-specific options. +# +# One can use all long options that the program supports. +# Run program with --help to get a list of available options and with +# --print-defaults to see which it would actually understand and use. +# +# For explanations see +# http://dev.mysql.com/doc/mysql/en/server-system-variables.html + +# This will be passed to all mysql clients +# It has been reported that passwords should be enclosed with ticks/quotes +# escpecially if they contain "#" chars... +# Remember to edit /etc/mysql/debian.cnf when changing the socket location. +[client] +port = 3306 +socket = /var/run/mysqld/mysqld.sock + +# Here is entries for some specific programs +# The following values assume you have at least 32M ram + +# This was formally known as [safe_mysqld]. Both versions are currently parsed. +[mysqld_safe] +socket = /var/run/mysqld/mysqld.sock +nice = 0 + +[mysqld] +# +# * Basic Settings +# +user = mysql +pid-file = /var/run/mysqld/mysqld.pid +socket = /var/run/mysqld/mysqld.sock +port = 3306 +basedir = /usr +datadir = /var/lib/mysql +tmpdir = /tmp +lc-messages-dir = /usr/share/mysql +skip-external-locking +# +# Instead of skip-networking the default is now to listen only on +# localhost which is more compatible and is not less secure. +bind-address = 0.0.0.0 +# +# * Fine Tuning +# +key_buffer = 16M +max_allowed_packet = 16M +thread_stack = 192K +thread_cache_size = 8 +# This replaces the startup script and checks MyISAM tables if needed +# the first time they are touched +myisam-recover = BACKUP +#max_connections = 100 +#table_cache = 64 +#thread_concurrency = 10 +# +# * Query Cache Configuration +# +query_cache_limit = 1M +query_cache_size = 16M +# +# * Logging and Replication +# +# Both location gets rotated by the cronjob. +# Be aware that this log type is a performance killer. +# As of 5.1 you can enable the log at runtime! +#general_log_file = /var/log/mysql/mysql.log +#general_log = 1 +# +# Error log - should be very few entries. +# +log_error = /var/log/mysql/error.log +# +# Here you can see queries with especially long duration +#log_slow_queries = /var/log/mysql/mysql-slow.log +#long_query_time = 2 +#log-queries-not-using-indexes +# +# The following can be used as easy to replay backup logs or for replication. +# note: if you are setting up a replication slave, see README.Debian about +# other settings you may need to change. +#server-id = 1 +#log_bin = /var/log/mysql/mysql-bin.log +expire_logs_days = 10 +max_binlog_size = 100M +#binlog_do_db = include_database_name +#binlog_ignore_db = include_database_name +# +# * InnoDB +# +# InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. +# Read the manual for more InnoDB related options. There are many! +# +# * Security Features +# +# Read the manual, too, if you want chroot! +# chroot = /var/lib/mysql/ +# +# For generating SSL certificates I recommend the OpenSSL GUI "tinyca". +# +# ssl-ca=/etc/mysql/cacert.pem +# ssl-cert=/etc/mysql/server-cert.pem +# ssl-key=/etc/mysql/server-key.pem + + + +[mysqldump] +quick +quote-names +max_allowed_packet = 16M + +[mysql] +#no-auto-rehash # faster start of mysql but no tab completition + +[isamchk] +key_buffer = 16M + +# +# * IMPORTANT: Additional settings that can override those from this file! +# The files must end with '.cnf', otherwise they'll be ignored. +# +!includedir /etc/mysql/conf.d/ diff --git a/vagrant/install-mysql.sh b/vagrant/install-mysql.sh new file mode 100644 index 000000000..732db7221 --- /dev/null +++ b/vagrant/install-mysql.sh @@ -0,0 +1,3 @@ +debconf-set-selections <<< 'mysql-server mysql-server/root_password password devdb' +debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password devdb' +apt-get install -y -q mysql-server mysql-client php5-mysql \ No newline at end of file diff --git a/vagrant/install-postgre.sh b/vagrant/install-postgre.sh new file mode 100644 index 000000000..530403798 --- /dev/null +++ b/vagrant/install-postgre.sh @@ -0,0 +1 @@ +apt-get install -y -q postgresql php5-pgsql diff --git a/vagrant/install.sh b/vagrant/install.sh new file mode 100644 index 000000000..c2ca76a46 --- /dev/null +++ b/vagrant/install.sh @@ -0,0 +1,15 @@ +apt-get update +apt-get upgrade -y +apt-get install -y apache2 +apt-get install -y php5 php5-gd php5-mcrypt php5-curl +apt-get install -y nodejs npm +apt-get install -y openjdk-7-jre +apt-get install -y git +apt-get install -y dos2unix + +ln -s /usr/bin/nodejs /usr/bin/node +npm install -g less + +curl -sS https://getcomposer.org/installer | php +mv composer.phar /usr/local/bin/composer +chmod a+x /usr/local/bin/composer \ No newline at end of file diff --git a/vagrant/startup.sh b/vagrant/startup.sh new file mode 100644 index 000000000..37ebabcae --- /dev/null +++ b/vagrant/startup.sh @@ -0,0 +1,2 @@ + +apache2ctl restart diff --git a/vagrant/user.sh b/vagrant/user.sh new file mode 100644 index 000000000..99c22fbe9 --- /dev/null +++ b/vagrant/user.sh @@ -0,0 +1,8 @@ +composer global require "fxp/composer-asset-plugin:~1.0.3" +composer global require "codeception/codeception=2.0.*" +composer global require "codeception/specify=*" +composer global require "codeception/verify=*" + +pushd /vagrant +composer install +popd diff --git a/views/layouts/main.php b/views/layouts/main.php index d5b1b49ee..70e33825d 100644 --- a/views/layouts/main.php +++ b/views/layouts/main.php @@ -1,12 +1,9 @@ head() ?> -beginBody() ?> + beginBody() ?> -
- 'My Company', - 'brandUrl' => Yii::$app->homeUrl, - 'options' => [ - 'class' => 'navbar-inverse navbar-fixed-top', - ], - ]); - echo Nav::widget([ - 'options' => ['class' => 'navbar-nav navbar-right'], - 'items' => [ - ['label' => 'Home', 'url' => ['/site/index']], - ['label' => 'About', 'url' => ['/site/about']], - ['label' => 'Contact', 'url' => ['/site/contact']], - Yii::$app->user->isGuest ? - ['label' => 'Login', 'url' => ['/site/login']] : - [ - 'label' => 'Logout (' . Yii::$app->user->identity->username . ')', - 'url' => ['/site/logout'], - 'linkOptions' => ['data-method' => 'post'] - ], - ], - ]); - NavBar::end(); - ?> + -
- isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], - ]) ?> - -
-
- - - -endBody() ?> + endBody() ?> endPage() ?> diff --git a/views/site/about.php b/views/site/about.php deleted file mode 100644 index 68d5cf3bd..000000000 --- a/views/site/about.php +++ /dev/null @@ -1,18 +0,0 @@ -title = 'About'; -$this->params['breadcrumbs'][] = $this->title; -?> -
-

title) ?>

- -

- This is the About page. You may modify the following file to customize its content: -

- - -
diff --git a/views/site/contact.php b/views/site/contact.php deleted file mode 100644 index 22a75bbcc..000000000 --- a/views/site/contact.php +++ /dev/null @@ -1,68 +0,0 @@ -title = 'Contact'; -$this->params['breadcrumbs'][] = $this->title; -?> -
-

title) ?>

- - session->hasFlash('contactFormSubmitted')): ?> - -
- Thank you for contacting us. We will respond to you as soon as possible. -
- -

- Note that if you turn on the Yii debugger, you should be able - to view the mail message on the mail panel of the debugger. - mailer->useFileTransport): ?> - Because the application is in development mode, the email is not sent but saved as - a file under mailer->fileTransportPath) ?>. - Please configure the useFileTransport property of the mail - application component to be false to enable email sending. - -

- - - -

- If you have business inquiries or other questions, please fill out the following form to contact us. - Thank you. -

- -
-
- - 'contact-form']); ?> - - field($model, 'name') ?> - - field($model, 'email') ?> - - field($model, 'subject') ?> - - field($model, 'body')->textArea(['rows' => 6]) ?> - - field($model, 'verifyCode')->widget(Captcha::className(), [ - 'template' => '
{image}
{input}
', - ]) ?> - -
- 'btn btn-primary', 'name' => 'contact-button']) ?> -
- - - -
-
- - -
diff --git a/views/site/error.php b/views/site/error.php deleted file mode 100644 index 0ba257465..000000000 --- a/views/site/error.php +++ /dev/null @@ -1,27 +0,0 @@ -title = $name; -?> -
- -

title) ?>

- -
- -
- -

- The above error occurred while the Web server was processing your request. -

-

- Please contact us if you think this is a server error. Thank you. -

- -
diff --git a/views/site/index.php b/views/site/index.php index f78061088..980a0d5f1 100644 --- a/views/site/index.php +++ b/views/site/index.php @@ -1,53 +1 @@ -title = 'My Yii Application'; -?> -
- -
-

Congratulations!

- -

You have successfully created your Yii-powered application.

- -

Get started with Yii

-
- -
- -
-
-

Heading

- -

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et - dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip - ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu - fugiat nulla pariatur.

- -

Yii Documentation »

-
-
-

Heading

- -

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et - dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip - ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu - fugiat nulla pariatur.

- -

Yii Forum »

-
-
-

Heading

- -

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et - dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip - ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu - fugiat nulla pariatur.

- -

Yii Extensions »

-
-
- -
-
+Hello World! diff --git a/views/site/login.php b/views/site/login.php deleted file mode 100644 index 059ef8048..000000000 --- a/views/site/login.php +++ /dev/null @@ -1,47 +0,0 @@ -title = 'Login'; -$this->params['breadcrumbs'][] = $this->title; -?> -
-

title) ?>

- -

Please fill out the following fields to login:

- - 'login-form', - 'options' => ['class' => 'form-horizontal'], - 'fieldConfig' => [ - 'template' => "{label}\n
{input}
\n
{error}
", - 'labelOptions' => ['class' => 'col-lg-1 control-label'], - ], - ]); ?> - - field($model, 'username') ?> - - field($model, 'password')->passwordInput() ?> - - field($model, 'rememberMe')->checkbox([ - 'template' => "
{input} {label}
\n
{error}
", - ]) ?> - -
-
- 'btn btn-primary', 'name' => 'login-button']) ?> -
-
- - - -
- You may login with admin/admin or demo/demo.
- To modify the username/password, please check out the code app\models\User::$users. -
-
diff --git a/web/css/site.css b/web/css/site.css deleted file mode 100644 index 698be709c..000000000 --- a/web/css/site.css +++ /dev/null @@ -1,91 +0,0 @@ -html, -body { - height: 100%; -} - -.wrap { - min-height: 100%; - height: auto; - margin: 0 auto -60px; - padding: 0 0 60px; -} - -.wrap > .container { - padding: 70px 15px 20px; -} - -.footer { - height: 60px; - background-color: #f5f5f5; - border-top: 1px solid #ddd; - padding-top: 20px; -} - -.jumbotron { - text-align: center; - background-color: transparent; -} - -.jumbotron .btn { - font-size: 21px; - padding: 14px 24px; -} - -.not-set { - color: #c55; - font-style: italic; -} - -/* add sorting icons to gridview sort links */ -a.asc:after, a.desc:after { - position: relative; - top: 1px; - display: inline-block; - font-family: 'Glyphicons Halflings'; - font-style: normal; - font-weight: normal; - line-height: 1; - padding-left: 5px; -} - -a.asc:after { - content: /*"\e113"*/ "\e151"; -} - -a.desc:after { - content: /*"\e114"*/ "\e152"; -} - -.sort-numerical a.asc:after { - content: "\e153"; -} - -.sort-numerical a.desc:after { - content: "\e154"; -} - -.sort-ordinal a.asc:after { - content: "\e155"; -} - -.sort-ordinal a.desc:after { - content: "\e156"; -} - -.grid-view th { - white-space: nowrap; -} - -.hint-block { - display: block; - margin-top: 5px; - color: #999; -} - -.error-summary { - color: #a94442; - background: #fdf7f7; - border-left: 3px solid #eed3d7; - padding: 10px 20px; - margin: 0 0 15px 0; -} diff --git a/web/favicon.ico b/web/favicon.ico deleted file mode 100644 index 580ed732e..000000000 Binary files a/web/favicon.ico and /dev/null differ diff --git a/web/index.php b/web/index.php index d1e070a39..fc2c4af97 100644 --- a/web/index.php +++ b/web/index.php @@ -1,8 +1,9 @@