Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions assets/AppAsset.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
Expand Down
1 change: 1 addition & 0 deletions commands/HelloController.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* @link https://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
Expand Down
12 changes: 7 additions & 5 deletions config/__autocomplete.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,25 @@
* }
* ```
*/
class Yii {
class Yii
{
/**
* @var \yii\web\Application|\yii\console\Application|__Application
*/
public static $app;
}

/**
* @property yii\rbac\DbManager $authManager
* @property yii\rbac\DbManager $authManager
* @property \yii\web\User|__WebUser $user
*
*/
class __Application {
class __Application
{
}

/**
* @property app\models\User $identity
*/
class __WebUser {
class __WebUser
{
}
1 change: 1 addition & 0 deletions config/test.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

$params = require __DIR__ . '/params.php';
$db = require __DIR__ . '/test_db.php';

Expand Down
1 change: 1 addition & 0 deletions config/test_db.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

$db = require __DIR__ . '/db.php';
// test database! Important not to run tests on production or development databases
$db['dsn'] = 'mysql:host=localhost;dbname=yii2basic_test';
Expand Down
2 changes: 1 addition & 1 deletion mail/layouts/text.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

/**
/**
* @var yii\web\View $this view component instance
* @var yii\mail\BaseMessage $message the message being composed
* @var string $content main view render result
Expand Down
2 changes: 1 addition & 1 deletion models/LoginForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function validatePassword($attribute, $params)
public function login()
{
if ($this->validate()) {
return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0);
return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0);
}
return false;
}
Expand Down
1 change: 1 addition & 0 deletions requirements.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Application requirement checker script.
*
Expand Down
3 changes: 2 additions & 1 deletion tests/_bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

define('YII_ENV', 'test');
defined('YII_DEBUG') or define('YII_DEBUG', true);

require_once __DIR__ . '/../vendor/yiisoft/yii2/Yii.php';
require __DIR__ .'/../vendor/autoload.php';
require __DIR__ .'/../vendor/autoload.php';
6 changes: 3 additions & 3 deletions tests/_support/AcceptanceTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AcceptanceTester extends \Codeception\Actor
{
use _generated\AcceptanceTesterActions;

/**
* Define custom actions here
*/
/**
* Define custom actions here
*/
}
1 change: 0 additions & 1 deletion tests/_support/FunctionalTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@
class FunctionalTester extends \Codeception\Actor
{
use _generated\FunctionalTesterActions;

}
6 changes: 3 additions & 3 deletions tests/_support/UnitTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class UnitTester extends \Codeception\Actor
{
use _generated\UnitTesterActions;

/**
* Define custom actions here
*/
/**
* Define custom actions here
*/
}
4 changes: 2 additions & 2 deletions tests/acceptance/ContactCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public function _before(\AcceptanceTester $I)
{
$I->amOnPage(Url::toRoute('/site/contact'));
}

public function contactPageWorks(AcceptanceTester $I)
{
$I->wantTo('ensure that contact page works');
Expand All @@ -25,7 +25,7 @@ public function contactFormCanBeSubmitted(AcceptanceTester $I)
$I->fillField('#contactform-verifycode', 'testme');

$I->click('contact-button');

$I->wait(2); // wait for button to be clicked

$I->dontSeeElement('#contact-form');
Expand Down
6 changes: 3 additions & 3 deletions tests/acceptance/HomeCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ class HomeCest
{
public function ensureThatHomePageWorks(AcceptanceTester $I)
{
$I->amOnPage(Url::toRoute('/site/index'));
$I->amOnPage(Url::toRoute('/site/index'));
$I->see('My Company');

$I->seeLink('About');
$I->click('About');
$I->wait(2); // wait for page to be opened

$I->see('This is the About page.');
}
}
8 changes: 4 additions & 4 deletions tests/functional/ContactFormCest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

class ContactFormCest
class ContactFormCest
{
public function _before(\FunctionalTester $I)
{
Expand All @@ -9,7 +9,7 @@ public function _before(\FunctionalTester $I)

public function openContactPage(\FunctionalTester $I)
{
$I->see('Contact', 'h1');
$I->see('Contact', 'h1');
}

public function submitEmptyForm(\FunctionalTester $I)
Expand Down Expand Up @@ -38,7 +38,7 @@ public function submitFormWithIncorrectEmail(\FunctionalTester $I)
$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->dontSee('The verification code is incorrect', '.help-inline');
}

public function submitFormSuccessfully(\FunctionalTester $I)
Expand All @@ -52,6 +52,6 @@ public function submitFormSuccessfully(\FunctionalTester $I)
]);
$I->seeEmailIsSent();
$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.');
}
}
5 changes: 2 additions & 3 deletions tests/functional/LoginFormCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ public function _before(\FunctionalTester $I)
public function openLoginPage(\FunctionalTester $I)
{
$I->see('Login', 'h1');

}

// demonstrates `amLoggedInAs` method
Expand Down Expand Up @@ -54,6 +53,6 @@ public function loginSuccessfully(\FunctionalTester $I)
'LoginForm[password]' => 'admin',
]);
$I->see('Logout (admin)');
$I->dontSeeElement('form#login-form');
$I->dontSeeElement('form#login-form');
}
}
}
1 change: 0 additions & 1 deletion tests/unit/models/LoginFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,4 @@ public function testLoginCorrect()
verify(\Yii::$app->user->isGuest)->false();
verify($this->model->errors)->arrayHasNotKey('password');
}

}
5 changes: 2 additions & 3 deletions tests/unit/models/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testFindUserByAccessToken()
verify($user = User::findIdentityByAccessToken('100-token'))->notEmpty();
verify($user->username)->equals('admin');

verify(User::findIdentityByAccessToken('non-existing'))->empty();
verify(User::findIdentityByAccessToken('non-existing'))->empty();
}

public function testFindUserByUsername()
Expand All @@ -38,7 +38,6 @@ public function testValidateUser()
verify($user->validateAuthKey('test102key'))->empty();

verify($user->validatePassword('admin'))->notEmpty();
verify($user->validatePassword('123456'))->empty();
verify($user->validatePassword('123456'))->empty();
}

}
6 changes: 4 additions & 2 deletions tests/unit/widgets/AlertTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ public function testMultipleWarningMessages()
verify($renderingResult)->stringNotContainsString('alert-info');
}

public function testSingleMixedMessages() {
public function testSingleMixedMessages()
{
$errorMessage = 'This is an error message';
$dangerMessage = 'This is a danger message';
$successMessage = 'This is a success message';
Expand All @@ -204,7 +205,8 @@ public function testSingleMixedMessages() {
verify($renderingResult)->stringContainsString('alert-warning');
}

public function testMultipleMixedMessages() {
public function testMultipleMixedMessages()
{
$firstErrorMessage = 'This is the first error message';
$secondErrorMessage = 'This is the second error message';
$firstDangerMessage = 'This is the first danger message';
Expand Down