Skip to content

Commit

Permalink
Update to release v1.6.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kartik-v committed Apr 8, 2016
1 parent a359dd7 commit 08c8e62
Show file tree
Hide file tree
Showing 31 changed files with 316 additions and 162 deletions.
6 changes: 6 additions & 0 deletions .gitattributes
@@ -0,0 +1,6 @@
# Ignore all test and documentation for archive
/.github export-ignore
/.gitattributes export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/docs export-ignore
7 changes: 7 additions & 0 deletions .github/CONTRIBUTING.md
@@ -0,0 +1,7 @@
Contributing to Yii2
====================

- [Report an issue](docs/internals/report-an-issue.md)
- [Translate documentation or messages](docs/internals/translation-workflow.md)
- [Give us feedback or start a design discussion](http://www.yiiframework.com/forum/index.php/forum/42-general-discussions-for-yii-20/)
- [Contribute to the core code or fix bugs](docs/internals/git-workflow.md)
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE.md
@@ -0,0 +1,13 @@
### What steps will reproduce the problem?

### What is expected?

### What do you get instead?

### Additional info

| Question | Answer
| ---------------- | ----------------
| Yii version |
| PHP version |
| Operating system |
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,7 @@
| Question | Answer
| ------------- | -------------
| Is bugfix? | yes/no
| New feature? | yes/no
| Breaks BC? | yes/no
| Tests pass? | yes/no
| Fixed issues | comma-separated list of tickets # fixed by the PR, if any
6 changes: 3 additions & 3 deletions .htaccess
@@ -1,8 +1,8 @@
# ----------------------------------------------------------------------
# Adds some security for the Apache server configuration for use with
# yii2-app-practical-b template.
# https://github.com/kartik-v/yii2-app-practical-b template.
# @author Kartik Visweswaran <kartikv2@gmail.com>
# @see http://demos.krajee.com/app-practical
# @see http://demos.krajee.com/app-practical-b
# ----------------------------------------------------------------------

# "-Indexes" will have Apache block users from browsing folders without a default document
Expand All @@ -23,7 +23,7 @@


# Block access to backup and source files
# This files may be left by some text/html editors and
# These files may be left by some text/html editors and
# pose a great security danger, when someone can access them
<FilesMatch "(\.(bak|bat|config|sql|fla|md|psd|ini|log|sh|inc|swp|dist)|~|init|composer\.json|composer\.lock)$">
Order allow,deny
Expand Down
37 changes: 37 additions & 0 deletions .travis.yml
@@ -0,0 +1,37 @@
language: php

php:
- 5.4
- 5.5
- 5.6
- 7.0
# - hhvm

# faster builds on new travis setup not using sudo
sudo: false

# cache vendor dirs
cache:
directories:
- $HOME/.composer/cache

install:
- travis_retry composer self-update && composer --version
- travis_retry composer global require "fxp/composer-asset-plugin:~1.1.1"
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- travis_retry composer install --dev --prefer-dist --no-interaction
# codeception
- travis_retry composer global require "codeception/codeception=2.0.*" "codeception/specify=*" "codeception/verify=*"
# setup application:
- |
sed -i "s/'cookieValidationKey' => ''/'cookieValidationKey' => 'testkey'/" config/web.php
cd tests
codecept build
cd ..
script:
- |
cd web
php -S localhost:8080 > /dev/null 2>&1 &
cd ../tests
codecept run
3 changes: 2 additions & 1 deletion CHANGE.md
Expand Up @@ -3,9 +3,10 @@ Change Log: `yii2-app-practical-b`

## Version 1.6.2

**Date:** 2015-08-17
**Date:** 2016-04-08

- Updates to `composer.json` and `.gitignore`.
- Update to latest yii2-basic-app as of 08-Apr-2016.

## Version 1.6.1

Expand Down
16 changes: 13 additions & 3 deletions README.md
Expand Up @@ -89,6 +89,15 @@ a directory named `practical-b` that is directly under the Web root.
extract the [yii2-basic vendor folder from here](https://github.com/yiisoft/yii2/releases/download/2.0.0/yii-basic-app-2.0.0.tgz).
Then you must copy this folder directly under the app root (i.e. `practical-b` directory).

Set cookie validation key in `config/web.php` file to some random secret string:

```php
'request' => [
// !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
'cookieValidationKey' => '<secret random string goes here>',
],
```

You can then access the application through the following URL:

~~~
Expand Down Expand Up @@ -133,6 +142,7 @@ return [
];
```

**NOTE:** Yii won't create the database for you, this has to be done manually before you can access it.

Also check and edit the other files in the `config/` directory to customize your application.
**NOTES:**
- Yii won't create the database for you, this has to be done manually before you can access it.
- Check and edit the other files in the `config/` directory to customize your application as required.
- Refer to the README in the `tests` directory for information specific to basic application tests.
13 changes: 8 additions & 5 deletions composer.json
Expand Up @@ -13,13 +13,16 @@
}
],
"support": {
"issues": "https://github.com/kartik-v/yii2-app-practical-b/issues?state=open",
"source": "https://github.com/kartik-v/yii2-app-practical-b/"
},
"issues": "https://github.com/yiisoft/yii2/issues?state=open",
"forum": "http://www.yiiframework.com/forum/",
"wiki": "http://www.yiiframework.com/wiki/",
"irc": "irc://irc.freenode.net/yii",
"source": "https://github.com/yiisoft/yii2"
},
"minimum-stability": "dev",
"require": {
"php": ">=5.4.0",
"yiisoft/yii2": "*",
"yiisoft/yii2": ">=2.0.5",
"yiisoft/yii2-bootstrap": "*",
"yiisoft/yii2-swiftmailer": "*"
},
Expand All @@ -42,7 +45,7 @@
"setPermission": [
{
"runtime": "0777",
"assets": "0777",
"web/assets": "0777",
"yii": "0755"
}
],
Expand Down
28 changes: 21 additions & 7 deletions config/console.php
@@ -1,18 +1,15 @@
<?php

Yii::setAlias('@tests', dirname(__DIR__) . '/tests');
Yii::setAlias('@tests', dirname(__DIR__) . '/tests/codeception');

$params = require(__DIR__ . '/params.php');
$db = require(__DIR__ . '/db.php');

return [
$config = [
'id' => 'basic-console',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log', 'gii'],
'bootstrap' => ['log'],
'controllerNamespace' => 'app\commands',
'modules' => [
'gii' => 'yii\gii\Module',
],
'components' => [
'cache' => [
'class' => 'yii\caching\FileCache',
Expand All @@ -28,4 +25,21 @@
'db' => $db,
],
'params' => $params,
];
/*
'controllerMap' => [
'fixture' => [ // Fixture generation command line.
'class' => 'yii\faker\FixtureController',
],
],
*/
];

if (YII_ENV_DEV) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
];
}

return $config;
8 changes: 6 additions & 2 deletions config/web.php
Expand Up @@ -49,10 +49,14 @@
if (YII_ENV_DEV) {
// configuration adjustments for 'dev' environment
$config['bootstrap'][] = 'debug';
$config['modules']['debug'] = 'yii\debug\Module';
$config['modules']['debug'] = [
'class' => 'yii\debug\Module',
];

$config['bootstrap'][] = 'gii';
$config['modules']['gii'] = 'yii\gii\Module';
$config['modules']['gii'] = [
'class' => 'yii\gii\Module',
];
}

return $config;
28 changes: 13 additions & 15 deletions requirements.php
Expand Up @@ -85,12 +85,6 @@
'by' => '<a href="http://www.yiiframework.com/doc-2.0/yii-caching-memcache.html">MemCache</a>',
'memo' => extension_loaded('memcached') ? 'To use memcached set <a href="http://www.yiiframework.com/doc-2.0/yii-caching-memcache.html#$useMemcached-detail">MemCache::useMemcached</a> to <code>true</code>.' : ''
),
array(
'name' => 'APC extension',
'mandatory' => false,
'condition' => extension_loaded('apc'),
'by' => '<a href="http://www.yiiframework.com/doc-2.0/yii-caching-apccache.html">ApcCache</a>',
),
// CAPTCHA:
array(
'name' => 'GD PHP extension with FreeType support',
Expand All @@ -107,13 +101,6 @@
'memo' => $imagickMemo,
),
// PHP ini :
'phpSafeMode' => array(
'name' => 'PHP safe mode',
'mandatory' => false,
'condition' => $requirementsChecker->checkPhpIniOff("safe_mode"),
'by' => 'File uploading and console command execution',
'memo' => '"safe_mode" should be disabled at php.ini',
),
'phpExposePhp' => array(
'name' => 'Expose PHP',
'mandatory' => false,
Expand All @@ -131,9 +118,20 @@
'phpSmtp' => array(
'name' => 'PHP mail SMTP',
'mandatory' => false,
'condition' => strlen(ini_get('SMTP'))>0,
'condition' => strlen(ini_get('SMTP')) > 0,
'by' => 'Email sending',
'memo' => 'PHP mail SMTP server required',
),
);
$requirementsChecker->checkYii()->check($requirements)->render();

// OPcache check
if (!version_compare(phpversion(), '5.5', '>=')) {
$requirements[] = array(
'name' => 'APC extension',
'mandatory' => false,
'condition' => extension_loaded('apc'),
'by' => '<a href="http://www.yiiframework.com/doc-2.0/yii-caching-apccache.html">ApcCache</a>',
);
}

$requirementsChecker->checkYii()->check($requirements)->render();
20 changes: 18 additions & 2 deletions tests/README.md
Expand Up @@ -24,7 +24,7 @@ After creating the basic application, follow these steps to prepare for the test
2. Install faker extension by running the following from template root directory where `composer.json` is:

```
composer require --dev yiisoft/yii2-faker:*
composer require --dev "yiisoft/yii2-faker:*"
```

3. Create `yii2_basic_tests` database and update it by applying migrations (you may skip this step if you do not have created any migrations yet):
Expand All @@ -33,6 +33,9 @@ After creating the basic application, follow these steps to prepare for the test
codeception/bin/yii migrate
```

The command needs to be run in the `tests` directory.
The database configuration can be found at `tests/codeception/config/config.php`.

4. Build the test suites:

```
Expand All @@ -59,6 +62,17 @@ webserver. In the `web` directory execute the following:
codecept run unit
```

Fixtures Default Configuration
------------------------------
The `fixture` commands refer to the following `ActiveFixture` configuration by default:

- Fixtures path: `@tests/unit/fixtures`
- Fixtures data path: `@tests/unit/fixtures/data`
- Template files path: `@tests/unit/templates/fixtures`
- Namespace: `tests\unit\fixtures`

Where `@tests` refers to `@app/tests/codeception`.

Code coverage support
---------------------

Expand Down Expand Up @@ -90,6 +104,8 @@ from codeception site.

3. include `c3.php` file in your `index-test.php` file before application run, so it can catch needed requests.

4. edit `c3.php` to update config file path (~ line 55) with `$config_file = realpath(__DIR__ . '/../tests/codeception.yml');`

Configuration options that are used by remote code coverage:

- c3_url: url pointing to entry script that includes `c3.php` file, so `Codeception` will be able to produce code coverage;
Expand All @@ -108,4 +124,4 @@ codecept run acceptance --coverage-html --coverage-xml
```

Please refer to [Codeception tutorial](http://codeception.com/docs/01-Introduction) for
more details about writing and running acceptance, functional and unit tests.
more details about writing and running acceptance, functional and unit tests.
4 changes: 2 additions & 2 deletions tests/codeception/_bootstrap.php
Expand Up @@ -3,7 +3,7 @@
defined('YII_ENV') or define('YII_ENV', 'test');

defined('YII_TEST_ENTRY_URL') or define('YII_TEST_ENTRY_URL', parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_PATH));
defined('YII_TEST_ENTRY_FILE') or define('YII_TEST_ENTRY_FILE', dirname(dirname(__DIR__)) . '/index-test.php');
defined('YII_TEST_ENTRY_FILE') or define('YII_TEST_ENTRY_FILE', dirname(dirname(__DIR__)) . '/web/index-test.php');

require_once(__DIR__ . '/../../vendor/autoload.php');
require_once(__DIR__ . '/../../vendor/yiisoft/yii2/Yii.php');
Expand All @@ -13,4 +13,4 @@
$_SERVER['SERVER_NAME'] = parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_HOST);
$_SERVER['SERVER_PORT'] = parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_PORT) ?: '80';

Yii::setAlias('@tests', dirname(__DIR__));
Yii::setAlias('@tests', dirname(__DIR__));
4 changes: 3 additions & 1 deletion tests/codeception/acceptance/AboutCept.php
Expand Up @@ -2,7 +2,9 @@

use tests\codeception\_pages\AboutPage;

/* @var $scenario Codeception\Scenario */

$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that about works');
AboutPage::openBy($I);
$I->see('About', 'h1');
$I->see('About', 'h1');
12 changes: 10 additions & 2 deletions tests/codeception/acceptance/ContactCept.php
Expand Up @@ -2,6 +2,8 @@

use tests\codeception\_pages\ContactPage;

/* @var $scenario Codeception\Scenario */

$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that contact works');

Expand All @@ -11,6 +13,9 @@

$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');
Expand All @@ -27,7 +32,10 @@
'body' => 'test content',
'verifyCode' => 'testme',
]);
$I->expectTo('see that email adress is wrong');
if (method_exists($I, 'wait')) {
$I->wait(3); // only for selenium
}
$I->expectTo('see that email address 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');
Expand All @@ -46,4 +54,4 @@
$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.');
$I->see('Thank you for contacting us. We will respond to you as soon as possible.');

0 comments on commit 08c8e62

Please sign in to comment.