Bläddra i källkod

Tests

refactoring
Guillaume 1 år sedan
förälder
incheckning
9f0a5a95c9
47 ändrade filer med 1882 tillägg och 1419 borttagningar
  1. +1
    -1
      backend/config/main.php
  2. +82
    -82
      common/config/main.php
  3. +29
    -0
      common/config/test-local.php
  4. +830
    -567
      composer.lock
  5. +33
    -1
      tests/_bootstrap.php
  6. +134
    -11
      tests/codeception/backend/_support/_generated/AcceptanceTesterActions.php
  7. +163
    -36
      tests/codeception/backend/_support/_generated/FunctionalTesterActions.php
  8. +1
    -1
      tests/codeception/backend/_support/_generated/UnitTesterActions.php
  9. +10
    -0
      tests/codeception/codeception.yml
  10. +1
    -1
      tests/codeception/common/_pages/LoginPage.php
  11. +26
    -0
      tests/codeception/common/_support/UnitTester.php
  12. +16
    -0
      tests/codeception/common/_support/_generated/UnitTesterActions.php
  13. +1
    -1
      tests/codeception/common/fixtures/UserFixture.php
  14. +1
    -1
      tests/codeception/common/unit/models/LoginFormTest.php
  15. +1
    -1
      tests/codeception/config/backend/acceptance.php
  16. +1
    -1
      tests/codeception/config/backend/functional.php
  17. +1
    -1
      tests/codeception/config/backend/unit.php
  18. +1
    -1
      tests/codeception/config/common/unit.php
  19. +7
    -3
      tests/codeception/config/config.php
  20. +1
    -1
      tests/codeception/config/console/unit.php
  21. +1
    -1
      tests/codeception/config/frontend/acceptance.php
  22. +1
    -1
      tests/codeception/config/frontend/functional.php
  23. +1
    -1
      tests/codeception/config/frontend/unit.php
  24. +26
    -0
      tests/codeception/console/_support/UnitTester.php
  25. +16
    -0
      tests/codeception/console/_support/_generated/UnitTesterActions.php
  26. +1
    -1
      tests/codeception/frontend/_bootstrap.php
  27. +134
    -11
      tests/codeception/frontend/_support/_generated/AcceptanceTesterActions.php
  28. +163
    -36
      tests/codeception/frontend/_support/_generated/FunctionalTesterActions.php
  29. +1
    -1
      tests/codeception/frontend/_support/_generated/UnitTesterActions.php
  30. +0
    -10
      tests/codeception/frontend/acceptance/AboutCept.php
  31. +0
    -56
      tests/codeception/frontend/acceptance/ContactCept.php
  32. +0
    -12
      tests/codeception/frontend/acceptance/HomeCept.php
  33. +0
    -34
      tests/codeception/frontend/acceptance/LoginCept.php
  34. +0
    -82
      tests/codeception/frontend/acceptance/SignupCest.php
  35. +0
    -47
      tests/codeception/frontend/functional/ContactCept.php
  36. +3
    -6
      tests/codeception/frontend/functional/HomeCept.php
  37. +0
    -29
      tests/codeception/frontend/functional/LoginCept.php
  38. +3
    -4
      tests/codeception/frontend/functional/ProducersCept.php
  39. +0
    -90
      tests/codeception/frontend/functional/SignupCest.php
  40. +0
    -59
      tests/codeception/frontend/unit/models/ContactFormTest.php
  41. +0
    -88
      tests/codeception/frontend/unit/models/PasswordResetRequestFormTest.php
  42. +0
    -44
      tests/codeception/frontend/unit/models/ResetPasswordFormTest.php
  43. +0
    -53
      tests/codeception/frontend/unit/models/SignupFormTest.php
  44. +122
    -11
      tests/codeception/tests/_support/_generated/AcceptanceTesterActions.php
  45. +1
    -1
      tests/codeception/tests/_support/_generated/FunctionalTesterActions.php
  46. +69
    -5
      tests/codeception/tests/_support/_generated/UnitTesterActions.php
  47. +0
    -26
      tests/functional/MyNewScenarioCest.php

+ 1
- 1
backend/config/main.php Visa fil

@@ -46,8 +46,8 @@ $common_config_main = array_merge(require(__DIR__ . '/../../common/config/main.p

return [
'id' => 'app-backend',
'name' => 'distrib',
'basePath' => dirname(__DIR__),
'name' => 'distrib',
'controllerNamespace' => 'backend\controllers',
'defaultRoute' => 'site/index',
'bootstrap' => ['log'],

+ 82
- 82
common/config/main.php Visa fil

@@ -38,90 +38,90 @@

use common\components\BusinessLogic;

$serverName = $_SERVER['SERVER_NAME'];
$serverName = isset($_SERVER['SERVER_NAME']) ?? '';

return [
'aliases' => [
'@bower' => '@vendor/bower-asset',
'aliases' => [
'@bower' => '@vendor/bower-asset',
],
'vendorPath' => dirname(__DIR__, 2) . '/vendor',
'on beforeRequest' => function () {
if (method_exists(Yii::$app->request, 'getAbsoluteUrl')) {
$url = Yii::$app->request->getAbsoluteUrl();
if ($_SERVER['SERVER_NAME'] != 'localhost' && !empty($url) && substr($url, -1) == '/' && substr($url, -5) != '.net/') {
$url = substr($url, 0, strlen($url) - 1);
Yii::$app->getResponse()->redirect($url, 301);
Yii::$app->end();
}
}
},
'components' => [
'assetManager' => [
'linkAssets' => YII_ENV == "dev" ? 'true' : false,
],
'vendorPath' => dirname(dirname(__DIR__)) . '/vendor',
'on beforeRequest' => function () {
if (method_exists(Yii::$app->request, 'getAbsoluteUrl')) {
$url = Yii::$app->request->getAbsoluteUrl();
if ($_SERVER['SERVER_NAME'] != 'localhost' && !empty($url) && substr($url, -1) == '/' && substr($url, -5) != '.net/') {
$url = substr($url, 0, strlen($url) - 1);
Yii::$app->getResponse()->redirect($url, 301);
Yii::$app->end();
}
}
},
'components' => [
'assetManager' => [
'linkAssets' => YII_ENV == "dev" ? 'true' : false,
],
'user' => [
'class' => 'yii\web\User',
'identityClass' => 'common\logic\User\User\Model\User',
'enableAutoLogin' => true,
'identityCookie' => [
'name' => 'distrib',
'domain' => (($serverName != 'localhost') ? '.' : '') . Yii::getAlias('@domainName'),
'path' => '/',
]
],
'session' => [
'class' => 'yii\web\Session',
'name' => 'PHPDISTRIBSESSID',
'cookieParams' => [
'domain' => (($serverName != 'localhost') ? '.' : '') . Yii::getAlias('@domainName'),
'httpOnly' => true,
],
],
'cache' => [
'class' => 'yii\caching\FileCache',
],
'image' => [
'class' => 'yii\image\ImageDriver',
'driver' => 'GD', //GD or Imagick
],
'urlManagerProducer' => [
'class' => 'producer\components\UrlManagerProducer',
'subDomain' => Yii::getAlias('@producerSubdomain'),
'domainName' => Yii::getAlias('@domainName'),
'baseUrl' => Yii::getAlias('@baseUrl') . Yii::getAlias('@baseUrlProducer'),
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => false,
'rules' => [
'<slug_producer:\w+>' => 'site/index',
'<slug_producer:\w+>/<controller>/<action>' => '<controller>/<action>',
],
],
'urlManagerFrontend' => [
'class' => 'common\components\UrlManagerCommon',
'subDomain' => Yii::getAlias('@frontendSubdomain'),
'domainName' => Yii::getAlias('@domainName'),
'baseUrl' => Yii::getAlias('@baseUrl') . Yii::getAlias('@baseUrlFrontend'),
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => false,
'rules' => [
],
],
'urlManagerBackend' => [
'class' => 'common\components\UrlManagerCommon',
'subDomain' => Yii::getAlias('@backendSubdomain'),
'domainName' => Yii::getAlias('@domainName'),
'baseUrl' => Yii::getAlias('@baseUrl') . Yii::getAlias('@baseUrlBackend'),
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => false,
'rules' => [
],
],
'logic' => function() {
return new BusinessLogic();
}
'user' => [
'class' => 'yii\web\User',
'identityClass' => 'common\logic\User\User\Model\User',
'enableAutoLogin' => true,
'identityCookie' => [
'name' => 'distrib',
'domain' => (($serverName != 'localhost') ? '.' : '') . Yii::getAlias('@domainName'),
'path' => '/',
]
],
'language' => 'fr-FR',
'session' => [
'class' => 'yii\web\Session',
'name' => 'PHPDISTRIBSESSID',
'cookieParams' => [
'domain' => (($serverName != 'localhost') ? '.' : '') . Yii::getAlias('@domainName'),
'httpOnly' => true,
],
],
'cache' => [
'class' => 'yii\caching\FileCache',
],
'image' => [
'class' => 'yii\image\ImageDriver',
'driver' => 'GD', //GD or Imagick
],
'urlManagerProducer' => [
'class' => 'producer\components\UrlManagerProducer',
'subDomain' => Yii::getAlias('@producerSubdomain'),
'domainName' => Yii::getAlias('@domainName'),
'baseUrl' => Yii::getAlias('@baseUrl') . Yii::getAlias('@baseUrlProducer'),
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => false,
'rules' => [
'<slug_producer:\w+>' => 'site/index',
'<slug_producer:\w+>/<controller>/<action>' => '<controller>/<action>',
],
],
'urlManagerFrontend' => [
'class' => 'common\components\UrlManagerCommon',
'subDomain' => Yii::getAlias('@frontendSubdomain'),
'domainName' => Yii::getAlias('@domainName'),
'baseUrl' => Yii::getAlias('@baseUrl') . Yii::getAlias('@baseUrlFrontend'),
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => false,
'rules' => [
],
],
'urlManagerBackend' => [
'class' => 'common\components\UrlManagerCommon',
'subDomain' => Yii::getAlias('@backendSubdomain'),
'domainName' => Yii::getAlias('@domainName'),
'baseUrl' => Yii::getAlias('@baseUrl') . Yii::getAlias('@baseUrlBackend'),
'enablePrettyUrl' => true,
'showScriptName' => false,
'enableStrictParsing' => false,
'rules' => [
],
],
'logic' => function () {
return new BusinessLogic();
}
],
'language' => 'fr-FR',
];

+ 29
- 0
common/config/test-local.php Visa fil

@@ -0,0 +1,29 @@
<?php

return [
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=opendistrib_test',
'username' => 'root',
'password' => 'k&mysql*$=',
'charset' => 'utf8',
],
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@common/mail',
// 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,
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'smtp-laclic.alwaysdata.net',
'username' => 'contact@opendistrib.net',
'password' => 'k&opendistrib*$=',
'port' => '587',
//'encryption' => 'tls',
],
],
],
];

+ 830
- 567
composer.lock
Filskillnaden har hållits tillbaka eftersom den är för stor
Visa fil


+ 33
- 1
tests/_bootstrap.php Visa fil

@@ -2,4 +2,36 @@
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';

// @see common/config/bootstrap.php
$dirname = dirname(__DIR__);
Yii::setAlias('common', $dirname.'/common');
Yii::setAlias('frontend', $dirname . '/frontend');
Yii::setAlias('backend', $dirname . '/backend');
Yii::setAlias('console', $dirname . '/console');
Yii::setAlias('producer', $dirname . '/producer');

$serverName = isset($_SERVER['SERVER_NAME']) ?? '' ;
$domainName = '' ;
if($serverName == 'localhost') {
$domainName = 'localhost' ;
}
else {
$domainName = (YII_ENV === 'dev') ? 'opendistrib-beta.net' : 'opendistrib.net' ;
}

Yii::setAlias('@domainName', $domainName);
Yii::setAlias('@baseUrl', ($serverName == 'localhost') ? '/Opendistrib/' : '/');
Yii::setAlias('@baseUrlFrontend', (($serverName == 'localhost') ? '/frontend/web' : ''));
Yii::setAlias('@baseUrlBackend', (($serverName == 'localhost') ? '/backend/web' : ''));
Yii::setAlias('@baseUrlProducer', (($serverName == 'localhost') ? '/producer/web' : ''));
Yii::setAlias('@frontendSubdomain', (($serverName == 'localhost') ? '' : 'www'));
Yii::setAlias('@backendSubdomain', (($serverName == 'localhost') ? '' : 'admin'));
Yii::setAlias('@producerSubdomain', (($serverName == 'localhost') ? '' : 'producteurs'));

/*
* Autoload
*/
Yii::$classMap['Import'] = Yii::getAlias('@common/exts/Import.php');
Import::using('common\components\*');

+ 134
- 11
tests/codeception/backend/_support/_generated/AcceptanceTesterActions.php Visa fil

@@ -1,4 +1,4 @@
<?php //[STAMP] 95a302f02389156d9cbbb435ba70b332
<?php //[STAMP] 07c05d2f1dfce28c06b749b2ec62500c
namespace tests\codeception\backend\_generated;

// This class was automatically generated by build task
@@ -217,7 +217,7 @@ trait AcceptanceTesterActions
* // CSS button
* $I->click('#form input[type=submit]');
* // XPath
* $I->click('//form/*[@type=submit]');
* $I->click('//form/*[@type="submit"]');
* // link in context
* $I->click('Logout', '#nav');
* // using strict locator
@@ -265,7 +265,7 @@ trait AcceptanceTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::see()
*/
@@ -303,7 +303,7 @@ trait AcceptanceTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* @see \Codeception\Lib\InnerBrowser::see()
*/
public function see($text, $selector = null) {
@@ -340,7 +340,7 @@ trait AcceptanceTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::dontSee()
*/
@@ -376,7 +376,7 @@ trait AcceptanceTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* @see \Codeception\Lib\InnerBrowser::dontSee()
*/
public function dontSee($text, $selector = null) {
@@ -714,7 +714,7 @@ trait AcceptanceTesterActions
* ``` php
* <?php
* // to match root url
* $I->seeCurrentUrlMatches('~$/users/(\d+)~');
* $I->seeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -733,7 +733,7 @@ trait AcceptanceTesterActions
* ``` php
* <?php
* // to match root url
* $I->seeCurrentUrlMatches('~$/users/(\d+)~');
* $I->seeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -753,7 +753,7 @@ trait AcceptanceTesterActions
* ``` php
* <?php
* // to match root url
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -772,7 +772,7 @@ trait AcceptanceTesterActions
* ``` php
* <?php
* // to match root url
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -792,7 +792,7 @@ trait AcceptanceTesterActions
*
* ``` php
* <?php
* $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~');
* $user_id = $I->grabFromCurrentUrl('~^/user/(\d+)/~');
* $uri = $I->grabFromCurrentUrl();
* ?>
* ```
@@ -2124,6 +2124,33 @@ trait AcceptanceTesterActions
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
*
* @param $from
* @param $to
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween()
*/
public function canSeeResponseCodeIsBetween($from, $to) {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsBetween', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
*
* @param $from
* @param $to
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween()
*/
public function seeResponseCodeIsBetween($from, $to) {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsBetween', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@@ -2163,6 +2190,90 @@ trait AcceptanceTesterActions
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 2xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful()
*/
public function canSeeResponseCodeIsSuccessful() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsSuccessful', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 2xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful()
*/
public function seeResponseCodeIsSuccessful() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsSuccessful', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 3xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection()
*/
public function canSeeResponseCodeIsRedirection() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsRedirection', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 3xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection()
*/
public function seeResponseCodeIsRedirection() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsRedirection', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 4xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError()
*/
public function canSeeResponseCodeIsClientError() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsClientError', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 4xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError()
*/
public function seeResponseCodeIsClientError() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsClientError', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 5xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError()
*/
public function canSeeResponseCodeIsServerError() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsServerError', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 5xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError()
*/
public function seeResponseCodeIsServerError() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsServerError', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@@ -2279,4 +2390,16 @@ trait AcceptanceTesterActions
public function fixtures() {
return $this->getScenario()->runStep(new \Codeception\Step\Action('fixtures', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Initialize the fixtures.
* @since 2.0.12
* @see \tests\codeception\common\_support\FixtureHelper::initFixtures()
*/
public function initFixtures() {
return $this->getScenario()->runStep(new \Codeception\Step\Action('initFixtures', func_get_args()));
}
}

+ 163
- 36
tests/codeception/backend/_support/_generated/FunctionalTesterActions.php Visa fil

@@ -1,4 +1,4 @@
<?php //[STAMP] bc506f891c6c86019a4495b1d981dae8
<?php //[STAMP] f27cd14eb2621d7d7c79eb236a027ea5
namespace tests\codeception\backend\_generated;

// This class was automatically generated by build task
@@ -670,6 +670,7 @@ trait FunctionalTesterActions
* @param $component
* @return mixed
* @throws ModuleException
* @deprecated in your tests you can use \Yii::$app directly.
* @see \Codeception\Module\Yii2::grabComponent()
*/
public function grabComponent($component) {
@@ -753,7 +754,7 @@ trait FunctionalTesterActions
* [!] Method is generated. Documentation taken from corresponding module.
*
* Returns array of all sent email messages.
* Each message implements `yii\mail\Message` interface.
* Each message implements `yii\mail\MessageInterface` interface.
* Useful to perform additional checks using `Asserts` module:
*
* ```php
@@ -805,6 +806,33 @@ trait FunctionalTesterActions
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Sets a cookie and, if validation is enabled, signs it.
* @param string $name The name of the cookie
* @param string $value The value of the cookie
* @param array $params Additional cookie params like `domain`, `path`, `expires` and `secure`.
* @see \Codeception\Module\Yii2::setCookie()
*/
public function setCookie($name, $val, $params = null) {
return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* This function creates the CSRF Cookie.
* @param string $val The value of the CSRF token
* @return string[] Returns an array containing the name of the CSRF param and the masked CSRF token.
* @see \Codeception\Module\Yii2::createAndSetCsrfCookie()
*/
public function createAndSetCsrfCookie($val) {
return $this->getScenario()->runStep(new \Codeception\Step\Action('createAndSetCsrfCookie', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@@ -922,7 +950,7 @@ trait FunctionalTesterActions
* // CSS button
* $I->click('#form input[type=submit]');
* // XPath
* $I->click('//form/*[@type=submit]');
* $I->click('//form/*[@type="submit"]');
* // link in context
* $I->click('Logout', '#nav');
* // using strict locator
@@ -970,7 +998,7 @@ trait FunctionalTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::see()
*/
@@ -1008,7 +1036,7 @@ trait FunctionalTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* @see \Codeception\Lib\InnerBrowser::see()
*/
public function see($text, $selector = null) {
@@ -1045,7 +1073,7 @@ trait FunctionalTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::dontSee()
*/
@@ -1081,7 +1109,7 @@ trait FunctionalTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* @see \Codeception\Lib\InnerBrowser::dontSee()
*/
public function dontSee($text, $selector = null) {
@@ -1419,7 +1447,7 @@ trait FunctionalTesterActions
* ``` php
* <?php
* // to match root url
* $I->seeCurrentUrlMatches('~$/users/(\d+)~');
* $I->seeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -1438,7 +1466,7 @@ trait FunctionalTesterActions
* ``` php
* <?php
* // to match root url
* $I->seeCurrentUrlMatches('~$/users/(\d+)~');
* $I->seeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -1458,7 +1486,7 @@ trait FunctionalTesterActions
* ``` php
* <?php
* // to match root url
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -1477,7 +1505,7 @@ trait FunctionalTesterActions
* ``` php
* <?php
* // to match root url
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -1497,7 +1525,7 @@ trait FunctionalTesterActions
*
* ``` php
* <?php
* $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~');
* $user_id = $I->grabFromCurrentUrl('~^/user/(\d+)/~');
* $uri = $I->grabFromCurrentUrl();
* ?>
* ```
@@ -2391,30 +2419,6 @@ trait FunctionalTesterActions
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Sets a cookie with the given name and value.
* You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument.
*
* ``` php
* <?php
* $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3');
* ?>
* ```
*
* @param $name
* @param $val
* @param array $params
*
* @return mixed
* @see \Codeception\Lib\InnerBrowser::setCookie()
*/
public function setCookie($name, $val, $params = null) {
return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@@ -2829,6 +2833,33 @@ trait FunctionalTesterActions
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
*
* @param $from
* @param $to
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween()
*/
public function canSeeResponseCodeIsBetween($from, $to) {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsBetween', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
*
* @param $from
* @param $to
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween()
*/
public function seeResponseCodeIsBetween($from, $to) {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsBetween', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@@ -2868,6 +2899,90 @@ trait FunctionalTesterActions
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 2xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful()
*/
public function canSeeResponseCodeIsSuccessful() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsSuccessful', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 2xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful()
*/
public function seeResponseCodeIsSuccessful() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsSuccessful', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 3xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection()
*/
public function canSeeResponseCodeIsRedirection() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsRedirection', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 3xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection()
*/
public function seeResponseCodeIsRedirection() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsRedirection', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 4xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError()
*/
public function canSeeResponseCodeIsClientError() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsClientError', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 4xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError()
*/
public function seeResponseCodeIsClientError() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsClientError', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 5xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError()
*/
public function canSeeResponseCodeIsServerError() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsServerError', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 5xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError()
*/
public function seeResponseCodeIsServerError() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsServerError', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@@ -2984,4 +3099,16 @@ trait FunctionalTesterActions
public function fixtures() {
return $this->getScenario()->runStep(new \Codeception\Step\Action('fixtures', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Initialize the fixtures.
* @since 2.0.12
* @see \tests\codeception\common\_support\FixtureHelper::initFixtures()
*/
public function initFixtures() {
return $this->getScenario()->runStep(new \Codeception\Step\Action('initFixtures', func_get_args()));
}
}

+ 1
- 1
tests/codeception/backend/_support/_generated/UnitTesterActions.php Visa fil

@@ -1,4 +1,4 @@
<?php //[STAMP] ed4d8cdd8d9d71e1210063b99c8b8445
<?php //[STAMP] e543475a72b3c2b2bbb166e62bf94035
namespace tests\codeception\backend\_generated;

// This class was automatically generated by build task

+ 10
- 0
tests/codeception/codeception.yml Visa fil

@@ -0,0 +1,10 @@
paths:
tests: tests
output: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
actor_suffix: Tester
extensions:
enabled:
- Codeception\Extension\RunFailed

+ 1
- 1
tests/codeception/common/_pages/LoginPage.php Visa fil

@@ -18,7 +18,7 @@ class LoginPage extends BasePage
*/
public function login($username, $password)
{
$this->actor->fillField('input[name="LoginForm[username]"]', $username);
$this->actor->fillField('input[name="LoginForm[email]"]', $username);
$this->actor->fillField('input[name="LoginForm[password]"]', $password);
$this->actor->click('login-button');
}

+ 26
- 0
tests/codeception/common/_support/UnitTester.php Visa fil

@@ -0,0 +1,26 @@
<?php
namespace tests\codeception\common;

/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
*
* @SuppressWarnings(PHPMD)
*/
class UnitTester extends \Codeception\Actor
{
use _generated\UnitTesterActions;

/**
* Define custom actions here
*/
}

+ 16
- 0
tests/codeception/common/_support/_generated/UnitTesterActions.php Visa fil

@@ -0,0 +1,16 @@
<?php //[STAMP] e543475a72b3c2b2bbb166e62bf94035
namespace tests\codeception\common\_generated;

// This class was automatically generated by build task
// You should not change it manually as it will be overwritten on next build
// @codingStandardsIgnoreFile

trait UnitTesterActions
{
/**
* @return \Codeception\Scenario
*/
abstract protected function getScenario();

}

+ 1
- 1
tests/codeception/common/fixtures/UserFixture.php Visa fil

@@ -9,5 +9,5 @@ use yii\test\ActiveFixture;
*/
class UserFixture extends ActiveFixture
{
public $modelClass = 'common\models\UserModel';
public $modelClass = 'common\logic\User\User\Model\User';
}

+ 1
- 1
tests/codeception/common/unit/models/LoginFormTest.php Visa fil

@@ -24,7 +24,7 @@ class LoginFormTest extends DbTestCase
'components' => [
'user' => [
'class' => 'yii\web\User',
'identityClass' => 'common\models\UserModel',
'identityClass' => 'common\logic\User\User\Model\User',
],
],
]);

+ 1
- 1
tests/codeception/config/backend/acceptance.php Visa fil

@@ -6,7 +6,7 @@ defined('YII_APP_BASE_PATH') or define('YII_APP_BASE_PATH', dirname(dirname(dirn
*/
return yii\helpers\ArrayHelper::merge(
require(YII_APP_BASE_PATH . '/common/config/main.php'),
require(YII_APP_BASE_PATH . '/common/config/main-local.php'),
require(YII_APP_BASE_PATH . '/common/config/test-local.php'),
require(YII_APP_BASE_PATH . '/backend/config/main.php'),
require(YII_APP_BASE_PATH . '/backend/config/main-local.php'),
require(dirname(__DIR__) . '/config.php'),

+ 1
- 1
tests/codeception/config/backend/functional.php Visa fil

@@ -7,7 +7,7 @@ $_SERVER['SCRIPT_NAME'] = YII_BACKEND_TEST_ENTRY_URL;
*/
return yii\helpers\ArrayHelper::merge(
require(YII_APP_BASE_PATH . '/common/config/main.php'),
require(YII_APP_BASE_PATH . '/common/config/main-local.php'),
require(YII_APP_BASE_PATH . '/common/config/test-local.php'),
require(YII_APP_BASE_PATH . '/backend/config/main.php'),
require(YII_APP_BASE_PATH . '/backend/config/main-local.php'),
require(dirname(__DIR__) . '/config.php'),

+ 1
- 1
tests/codeception/config/backend/unit.php Visa fil

@@ -5,7 +5,7 @@
*/
return yii\helpers\ArrayHelper::merge(
require(YII_APP_BASE_PATH . '/common/config/main.php'),
require(YII_APP_BASE_PATH . '/common/config/main-local.php'),
require(YII_APP_BASE_PATH . '/common/config/test-local.php'),
require(YII_APP_BASE_PATH . '/backend/config/main.php'),
require(YII_APP_BASE_PATH . '/backend/config/main-local.php'),
require(dirname(__DIR__) . '/config.php'),

+ 1
- 1
tests/codeception/config/common/unit.php Visa fil

@@ -4,7 +4,7 @@
*/
return yii\helpers\ArrayHelper::merge(
require(YII_APP_BASE_PATH . '/common/config/main.php'),
require(YII_APP_BASE_PATH . '/common/config/main-local.php'),
require(YII_APP_BASE_PATH . '/common/config/test-local.php'),
require(dirname(__DIR__) . '/config.php'),
require(dirname(__DIR__) . '/unit.php'),
[

+ 7
- 3
tests/codeception/config/config.php Visa fil

@@ -1,9 +1,13 @@
<?php

$config = yii\helpers\ArrayHelper::merge(
require(__DIR__ . '/../../../frontend/config/main.php'),
require(__DIR__ . '/../../../frontend/config/main-local.php'),
require(__DIR__ . '/../../../common/config/main.php'),
require(__DIR__ . '/../../../common/config/test-local.php'),
[
'id' => 'app-tests',
//'basePath' => dirname(__DIR__),
]
/*[
'id' => 'app-tests',
'components' => [
'db' => [
@@ -30,6 +34,6 @@ $config = yii\helpers\ArrayHelper::merge(
//'site' => 'app\controllers\SiteController',
//'frontend' => 'app\controllers\FrontendController',
],
]
]*/
);
return $config;

+ 1
- 1
tests/codeception/config/console/unit.php Visa fil

@@ -4,7 +4,7 @@
*/
return yii\helpers\ArrayHelper::merge(
require(YII_APP_BASE_PATH . '/common/config/main.php'),
require(YII_APP_BASE_PATH . '/common/config/main-local.php'),
require(YII_APP_BASE_PATH . '/common/config/test-local.php'),
require(YII_APP_BASE_PATH . '/console/config/main.php'),
require(YII_APP_BASE_PATH . '/console/config/main-local.php'),
require(dirname(__DIR__) . '/config.php'),

+ 1
- 1
tests/codeception/config/frontend/acceptance.php Visa fil

@@ -6,7 +6,7 @@ defined('YII_APP_BASE_PATH') or define('YII_APP_BASE_PATH', dirname(dirname(dirn
*/
return yii\helpers\ArrayHelper::merge(
require(YII_APP_BASE_PATH . '/common/config/main.php'),
require(YII_APP_BASE_PATH . '/common/config/main-local.php'),
require(YII_APP_BASE_PATH . '/common/config/test-local.php'),
require(YII_APP_BASE_PATH . '/frontend/config/main.php'),
require(YII_APP_BASE_PATH . '/frontend/config/main-local.php'),
require(dirname(__DIR__) . '/config.php'),

+ 1
- 1
tests/codeception/config/frontend/functional.php Visa fil

@@ -7,7 +7,7 @@ $_SERVER['SCRIPT_NAME'] = FRONTEND_ENTRY_URL;
*/
return yii\helpers\ArrayHelper::merge(
require(YII_APP_BASE_PATH . '/common/config/main.php'),
require(YII_APP_BASE_PATH . '/common/config/main-local.php'),
require(YII_APP_BASE_PATH . '/common/config/test-local.php'),
require(YII_APP_BASE_PATH . '/frontend/config/main.php'),
require(YII_APP_BASE_PATH . '/frontend/config/main-local.php'),
require(dirname(__DIR__) . '/config.php'),

+ 1
- 1
tests/codeception/config/frontend/unit.php Visa fil

@@ -5,7 +5,7 @@
*/
return yii\helpers\ArrayHelper::merge(
require(YII_APP_BASE_PATH . '/common/config/main.php'),
require(YII_APP_BASE_PATH . '/common/config/main-local.php'),
require(YII_APP_BASE_PATH . '/common/config/test-local.php'),
require(YII_APP_BASE_PATH . '/frontend/config/main.php'),
require(YII_APP_BASE_PATH . '/frontend/config/main-local.php'),
require(dirname(__DIR__) . '/config.php'),

+ 26
- 0
tests/codeception/console/_support/UnitTester.php Visa fil

@@ -0,0 +1,26 @@
<?php
namespace tests\codeception\console;

/**
* Inherited Methods
* @method void wantToTest($text)
* @method void wantTo($text)
* @method void execute($callable)
* @method void expectTo($prediction)
* @method void expect($prediction)
* @method void amGoingTo($argumentation)
* @method void am($role)
* @method void lookForwardTo($achieveValue)
* @method void comment($description)
* @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL)
*
* @SuppressWarnings(PHPMD)
*/
class UnitTester extends \Codeception\Actor
{
use _generated\UnitTesterActions;

/**
* Define custom actions here
*/
}

+ 16
- 0
tests/codeception/console/_support/_generated/UnitTesterActions.php Visa fil

@@ -0,0 +1,16 @@
<?php //[STAMP] e543475a72b3c2b2bbb166e62bf94035
namespace tests\codeception\console\_generated;

// This class was automatically generated by build task
// You should not change it manually as it will be overwritten on next build
// @codingStandardsIgnoreFile

trait UnitTesterActions
{
/**
* @return \Codeception\Scenario
*/
abstract protected function getScenario();

}

+ 1
- 1
tests/codeception/frontend/_bootstrap.php Visa fil

@@ -20,4 +20,4 @@ $_SERVER['SCRIPT_NAME'] = FRONTEND_ENTRY_URL;
$_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(dirname(__DIR__)));
Yii::setAlias('@tests', dirname(dirname(__DIR__)));

+ 134
- 11
tests/codeception/frontend/_support/_generated/AcceptanceTesterActions.php Visa fil

@@ -1,4 +1,4 @@
<?php //[STAMP] 95a302f02389156d9cbbb435ba70b332
<?php //[STAMP] 07c05d2f1dfce28c06b749b2ec62500c
namespace tests\codeception\frontend\_generated;

// This class was automatically generated by build task
@@ -217,7 +217,7 @@ trait AcceptanceTesterActions
* // CSS button
* $I->click('#form input[type=submit]');
* // XPath
* $I->click('//form/*[@type=submit]');
* $I->click('//form/*[@type="submit"]');
* // link in context
* $I->click('Logout', '#nav');
* // using strict locator
@@ -265,7 +265,7 @@ trait AcceptanceTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::see()
*/
@@ -303,7 +303,7 @@ trait AcceptanceTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* @see \Codeception\Lib\InnerBrowser::see()
*/
public function see($text, $selector = null) {
@@ -340,7 +340,7 @@ trait AcceptanceTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::dontSee()
*/
@@ -376,7 +376,7 @@ trait AcceptanceTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* @see \Codeception\Lib\InnerBrowser::dontSee()
*/
public function dontSee($text, $selector = null) {
@@ -714,7 +714,7 @@ trait AcceptanceTesterActions
* ``` php
* <?php
* // to match root url
* $I->seeCurrentUrlMatches('~$/users/(\d+)~');
* $I->seeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -733,7 +733,7 @@ trait AcceptanceTesterActions
* ``` php
* <?php
* // to match root url
* $I->seeCurrentUrlMatches('~$/users/(\d+)~');
* $I->seeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -753,7 +753,7 @@ trait AcceptanceTesterActions
* ``` php
* <?php
* // to match root url
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -772,7 +772,7 @@ trait AcceptanceTesterActions
* ``` php
* <?php
* // to match root url
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -792,7 +792,7 @@ trait AcceptanceTesterActions
*
* ``` php
* <?php
* $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~');
* $user_id = $I->grabFromCurrentUrl('~^/user/(\d+)/~');
* $uri = $I->grabFromCurrentUrl();
* ?>
* ```
@@ -2124,6 +2124,33 @@ trait AcceptanceTesterActions
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
*
* @param $from
* @param $to
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween()
*/
public function canSeeResponseCodeIsBetween($from, $to) {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsBetween', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
*
* @param $from
* @param $to
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween()
*/
public function seeResponseCodeIsBetween($from, $to) {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsBetween', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@@ -2163,6 +2190,90 @@ trait AcceptanceTesterActions
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 2xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful()
*/
public function canSeeResponseCodeIsSuccessful() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsSuccessful', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 2xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful()
*/
public function seeResponseCodeIsSuccessful() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsSuccessful', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 3xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection()
*/
public function canSeeResponseCodeIsRedirection() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsRedirection', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 3xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection()
*/
public function seeResponseCodeIsRedirection() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsRedirection', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 4xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError()
*/
public function canSeeResponseCodeIsClientError() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsClientError', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 4xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError()
*/
public function seeResponseCodeIsClientError() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsClientError', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 5xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError()
*/
public function canSeeResponseCodeIsServerError() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsServerError', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 5xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError()
*/
public function seeResponseCodeIsServerError() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsServerError', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@@ -2279,4 +2390,16 @@ trait AcceptanceTesterActions
public function fixtures() {
return $this->getScenario()->runStep(new \Codeception\Step\Action('fixtures', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Initialize the fixtures.
* @since 2.0.12
* @see \tests\codeception\common\_support\FixtureHelper::initFixtures()
*/
public function initFixtures() {
return $this->getScenario()->runStep(new \Codeception\Step\Action('initFixtures', func_get_args()));
}
}

+ 163
- 36
tests/codeception/frontend/_support/_generated/FunctionalTesterActions.php Visa fil

@@ -1,4 +1,4 @@
<?php //[STAMP] a85b178d5498babfb5e8fbdbde4a9381
<?php //[STAMP] 4504e1c6798573041028a69bcea3ae21
namespace tests\codeception\frontend\_generated;

// This class was automatically generated by build task
@@ -670,6 +670,7 @@ trait FunctionalTesterActions
* @param $component
* @return mixed
* @throws ModuleException
* @deprecated in your tests you can use \Yii::$app directly.
* @see \Codeception\Module\Yii2::grabComponent()
*/
public function grabComponent($component) {
@@ -753,7 +754,7 @@ trait FunctionalTesterActions
* [!] Method is generated. Documentation taken from corresponding module.
*
* Returns array of all sent email messages.
* Each message implements `yii\mail\Message` interface.
* Each message implements `yii\mail\MessageInterface` interface.
* Useful to perform additional checks using `Asserts` module:
*
* ```php
@@ -805,6 +806,33 @@ trait FunctionalTesterActions
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Sets a cookie and, if validation is enabled, signs it.
* @param string $name The name of the cookie
* @param string $value The value of the cookie
* @param array $params Additional cookie params like `domain`, `path`, `expires` and `secure`.
* @see \Codeception\Module\Yii2::setCookie()
*/
public function setCookie($name, $val, $params = null) {
return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* This function creates the CSRF Cookie.
* @param string $val The value of the CSRF token
* @return string[] Returns an array containing the name of the CSRF param and the masked CSRF token.
* @see \Codeception\Module\Yii2::createAndSetCsrfCookie()
*/
public function createAndSetCsrfCookie($val) {
return $this->getScenario()->runStep(new \Codeception\Step\Action('createAndSetCsrfCookie', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@@ -922,7 +950,7 @@ trait FunctionalTesterActions
* // CSS button
* $I->click('#form input[type=submit]');
* // XPath
* $I->click('//form/*[@type=submit]');
* $I->click('//form/*[@type="submit"]');
* // link in context
* $I->click('Logout', '#nav');
* // using strict locator
@@ -970,7 +998,7 @@ trait FunctionalTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::see()
*/
@@ -1008,7 +1036,7 @@ trait FunctionalTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* @see \Codeception\Lib\InnerBrowser::see()
*/
public function see($text, $selector = null) {
@@ -1045,7 +1073,7 @@ trait FunctionalTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::dontSee()
*/
@@ -1081,7 +1109,7 @@ trait FunctionalTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* @see \Codeception\Lib\InnerBrowser::dontSee()
*/
public function dontSee($text, $selector = null) {
@@ -1419,7 +1447,7 @@ trait FunctionalTesterActions
* ``` php
* <?php
* // to match root url
* $I->seeCurrentUrlMatches('~$/users/(\d+)~');
* $I->seeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -1438,7 +1466,7 @@ trait FunctionalTesterActions
* ``` php
* <?php
* // to match root url
* $I->seeCurrentUrlMatches('~$/users/(\d+)~');
* $I->seeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -1458,7 +1486,7 @@ trait FunctionalTesterActions
* ``` php
* <?php
* // to match root url
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -1477,7 +1505,7 @@ trait FunctionalTesterActions
* ``` php
* <?php
* // to match root url
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -1497,7 +1525,7 @@ trait FunctionalTesterActions
*
* ``` php
* <?php
* $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~');
* $user_id = $I->grabFromCurrentUrl('~^/user/(\d+)/~');
* $uri = $I->grabFromCurrentUrl();
* ?>
* ```
@@ -2391,30 +2419,6 @@ trait FunctionalTesterActions
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Sets a cookie with the given name and value.
* You can set additional cookie params like `domain`, `path`, `expires`, `secure` in array passed as last argument.
*
* ``` php
* <?php
* $I->setCookie('PHPSESSID', 'el4ukv0kqbvoirg7nkp4dncpk3');
* ?>
* ```
*
* @param $name
* @param $val
* @param array $params
*
* @return mixed
* @see \Codeception\Lib\InnerBrowser::setCookie()
*/
public function setCookie($name, $val, $params = null) {
return $this->getScenario()->runStep(new \Codeception\Step\Action('setCookie', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@@ -2829,6 +2833,33 @@ trait FunctionalTesterActions
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
*
* @param $from
* @param $to
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween()
*/
public function canSeeResponseCodeIsBetween($from, $to) {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsBetween', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
*
* @param $from
* @param $to
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween()
*/
public function seeResponseCodeIsBetween($from, $to) {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsBetween', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@@ -2868,6 +2899,90 @@ trait FunctionalTesterActions
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 2xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful()
*/
public function canSeeResponseCodeIsSuccessful() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsSuccessful', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 2xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful()
*/
public function seeResponseCodeIsSuccessful() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsSuccessful', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 3xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection()
*/
public function canSeeResponseCodeIsRedirection() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsRedirection', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 3xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection()
*/
public function seeResponseCodeIsRedirection() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsRedirection', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 4xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError()
*/
public function canSeeResponseCodeIsClientError() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsClientError', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 4xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError()
*/
public function seeResponseCodeIsClientError() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsClientError', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 5xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError()
*/
public function canSeeResponseCodeIsServerError() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsServerError', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 5xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError()
*/
public function seeResponseCodeIsServerError() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsServerError', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@@ -2984,4 +3099,16 @@ trait FunctionalTesterActions
public function fixtures() {
return $this->getScenario()->runStep(new \Codeception\Step\Action('fixtures', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Initialize the fixtures.
* @since 2.0.12
* @see \tests\codeception\common\_support\FixtureHelper::initFixtures()
*/
public function initFixtures() {
return $this->getScenario()->runStep(new \Codeception\Step\Action('initFixtures', func_get_args()));
}
}

+ 1
- 1
tests/codeception/frontend/_support/_generated/UnitTesterActions.php Visa fil

@@ -1,4 +1,4 @@
<?php //[STAMP] ed4d8cdd8d9d71e1210063b99c8b8445
<?php //[STAMP] e543475a72b3c2b2bbb166e62bf94035
namespace tests\codeception\frontend\_generated;

// This class was automatically generated by build task

+ 0
- 10
tests/codeception/frontend/acceptance/AboutCept.php Visa fil

@@ -1,10 +0,0 @@
<?php
use tests\codeception\frontend\AcceptanceTester;
use tests\codeception\frontend\_pages\AboutPage;

/* @var $scenario Codeception\Scenario */

$I = new AcceptanceTester($scenario);
$I->wantTo('ensure that about works');
AboutPage::openBy($I);
$I->see('About', 'h1');

+ 0
- 56
tests/codeception/frontend/acceptance/ContactCept.php Visa fil

@@ -1,56 +0,0 @@
<?php
use tests\codeception\frontend\AcceptanceTester;
use tests\codeception\frontend\_pages\ContactPage;

/* @var $scenario Codeception\Scenario */

$I = new AcceptanceTester($scenario);
$I->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', '.help-block');
$I->see('Email cannot be blank', '.help-block');
$I->see('Subject cannot be blank', '.help-block');
$I->see('Body cannot be blank', '.help-block');
$I->see('The verification code is incorrect', '.help-block');

$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-block');
$I->see('Email is not a valid email address.', '.help-block');
$I->dontSee('Subject cannot be blank', '.help-block');
$I->dontSee('Body cannot be blank', '.help-block');
$I->dontSee('The verification code is incorrect', '.help-block');

$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->see('Thank you for contacting us. We will respond to you as soon as possible.');

+ 0
- 12
tests/codeception/frontend/acceptance/HomeCept.php Visa fil

@@ -1,12 +0,0 @@
<?php
use tests\codeception\frontend\AcceptanceTester;

/* @var $scenario Codeception\Scenario */

$I = new AcceptanceTester($scenario);
$I->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.');

+ 0
- 34
tests/codeception/frontend/acceptance/LoginCept.php Visa fil

@@ -1,34 +0,0 @@
<?php
use tests\codeception\frontend\AcceptanceTester;
use tests\codeception\common\_pages\LoginPage;

/* @var $scenario Codeception\Scenario */

$I = new AcceptanceTester($scenario);
$I->wantTo('ensure login page works');

$loginPage = LoginPage::openBy($I);

$I->amGoingTo('submit login form with no data');
$loginPage->login('', '');
$I->expectTo('see validations errors');
$I->see('Username cannot be blank.', '.help-block');
$I->see('Password cannot be blank.', '.help-block');

$I->amGoingTo('try to login with wrong credentials');
$I->expectTo('see validations errors');
$loginPage->login('admin', 'wrong');
$I->expectTo('see validations errors');
$I->see('Incorrect username or password.', '.help-block');

$I->amGoingTo('try to login with correct credentials');
$loginPage->login('erau', 'password_0');
$I->expectTo('see that user is logged');
$I->seeLink('Logout (erau)');
$I->dontSeeLink('Login');
$I->dontSeeLink('Signup');
/** Uncomment if using WebDriver
* $I->click('Logout (erau)');
* $I->dontSeeLink('Logout (erau)');
* $I->seeLink('Login');
*/

+ 0
- 82
tests/codeception/frontend/acceptance/SignupCest.php Visa fil

@@ -1,82 +0,0 @@
<?php

namespace tests\codeception\frontend\acceptance;

use tests\codeception\frontend\_pages\SignupPage;
use common\models\UserModel;

class SignupCest
{

/**
* This method is called before each cest class test method
* @param \Codeception\Event\TestEvent $event
*/
public function _before($event)
{
}

/**
* This method is called after each cest class test method, even if test failed.
* @param \Codeception\Event\TestEvent $event
*/
public function _after($event)
{
UserModel::deleteAll([
'email' => 'tester.email@example.com',
'username' => 'tester',
]);
}

/**
* This method is called when test fails.
* @param \Codeception\Event\FailEvent $event
*/
public function _fail($event)
{
}

/**
* @param \codeception_frontend\AcceptanceTester $I
* @param \Codeception\Scenario $scenario
*/
public function testUserSignup($I, $scenario)
{
$I->wantTo('ensure that signup works');

$signupPage = SignupPage::openBy($I);
$I->see('Signup', 'h1');
$I->see('Please fill out the following fields to signup:');

$I->amGoingTo('submit signup form with no data');

$signupPage->submit([]);

$I->expectTo('see validation errors');
$I->see('Username cannot be blank.', '.help-block');
$I->see('Email cannot be blank.', '.help-block');
$I->see('Password cannot be blank.', '.help-block');

$I->amGoingTo('submit signup form with not correct email');
$signupPage->submit([
'username' => 'tester',
'email' => 'tester.email',
'password' => 'tester_password',
]);

$I->expectTo('see that email address is wrong');
$I->dontSee('Username cannot be blank.', '.help-block');
$I->dontSee('Password cannot be blank.', '.help-block');
$I->see('Email is not a valid email address.', '.help-block');

$I->amGoingTo('submit signup form with correct email');
$signupPage->submit([
'username' => 'tester',
'email' => 'tester.email@example.com',
'password' => 'tester_password',
]);

$I->expectTo('see that user logged in');
$I->seeLink('Logout (tester)');
}
}

+ 0
- 47
tests/codeception/frontend/functional/ContactCept.php Visa fil

@@ -1,47 +0,0 @@
<?php
use tests\codeception\frontend\FunctionalTester;
use tests\codeception\frontend\_pages\ContactPage;

/* @var $scenario Codeception\Scenario */

$I = new FunctionalTester($scenario);
$I->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', '.help-block');
$I->see('Email cannot be blank', '.help-block');
$I->see('Subject cannot be blank', '.help-block');
$I->see('Body cannot be blank', '.help-block');
$I->see('The verification code is incorrect', '.help-block');

$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-block');
$I->see('Email is not a valid email address.', '.help-block');
$I->dontSee('Subject cannot be blank', '.help-block');
$I->dontSee('Body cannot be blank', '.help-block');
$I->dontSee('The verification code is incorrect', '.help-block');

$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->see('Thank you for contacting us. We will respond to you as soon as possible.');

+ 3
- 6
tests/codeception/frontend/functional/HomeCept.php Visa fil

@@ -4,9 +4,6 @@ use tests\codeception\frontend\FunctionalTester;
/* @var $scenario Codeception\Scenario */

$I = new FunctionalTester($scenario);
$I->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.');
$I->wantTo("Page d'accueil");
$I->amOnPage('site/index');
$I->see('distribution');

+ 0
- 29
tests/codeception/frontend/functional/LoginCept.php Visa fil

@@ -1,29 +0,0 @@
<?php
use tests\codeception\frontend\FunctionalTester;
use tests\codeception\common\_pages\LoginPage;

/* @var $scenario Codeception\Scenario */

$I = new FunctionalTester($scenario);
$I->wantTo('ensure login page works');

$loginPage = LoginPage::openBy($I);

$I->amGoingTo('submit login form with no data');
$loginPage->login('', '');
$I->expectTo('see validations errors');
$I->see('Username cannot be blank.', '.help-block');
$I->see('Password cannot be blank.', '.help-block');

$I->amGoingTo('try to login with wrong credentials');
$I->expectTo('see validations errors');
$loginPage->login('admin', 'wrong');
$I->expectTo('see validations errors');
$I->see('Incorrect username or password.', '.help-block');

$I->amGoingTo('try to login with correct credentials');
$loginPage->login('erau', 'password_0');
$I->expectTo('see that user is logged');
$I->seeLink('Logout (erau)');
$I->dontSeeLink('Login');
$I->dontSeeLink('Signup');

tests/codeception/frontend/functional/AboutCept.php → tests/codeception/frontend/functional/ProducersCept.php Visa fil

@@ -1,10 +1,9 @@
<?php
use tests\codeception\frontend\FunctionalTester;
use tests\codeception\frontend\_pages\AboutPage;

/* @var $scenario Codeception\Scenario */

$I = new FunctionalTester($scenario);
$I->wantTo('ensure that about works');
AboutPage::openBy($I);
$I->see('About', 'h1');
$I->wantTo("Liste des producteurs");
$I->amOnPage('site/producers');
$I->see('Producteurs', 'h1');

+ 0
- 90
tests/codeception/frontend/functional/SignupCest.php Visa fil

@@ -1,90 +0,0 @@
<?php

namespace tests\codeception\frontend\functional;

use tests\codeception\frontend\_pages\SignupPage;
use common\models\UserModel;

class SignupCest
{

/**
* This method is called before each cest class test method
* @param \Codeception\Event\TestEvent $event
*/
public function _before($event)
{
}

/**
* This method is called after each cest class test method, even if test failed.
* @param \Codeception\Event\TestEvent $event
*/
public function _after($event)
{
UserModel::deleteAll([
'email' => 'tester.email@example.com',
'username' => 'tester',
]);
}

/**
* This method is called when test fails.
* @param \Codeception\Event\FailEvent $event
*/
public function _fail($event)
{

}

/**
*
* @param \codeception_frontend\FunctionalTester $I
* @param \Codeception\Scenario $scenario
*/
public function testUserSignup($I, $scenario)
{
$I->wantTo('ensure that signup works');

$signupPage = SignupPage::openBy($I);
$I->see('Signup', 'h1');
$I->see('Please fill out the following fields to signup:');

$I->amGoingTo('submit signup form with no data');

$signupPage->submit([]);

$I->expectTo('see validation errors');
$I->see('Username cannot be blank.', '.help-block');
$I->see('Email cannot be blank.', '.help-block');
$I->see('Password cannot be blank.', '.help-block');

$I->amGoingTo('submit signup form with not correct email');
$signupPage->submit([
'username' => 'tester',
'email' => 'tester.email',
'password' => 'tester_password',
]);

$I->expectTo('see that email address is wrong');
$I->dontSee('Username cannot be blank.', '.help-block');
$I->dontSee('Password cannot be blank.', '.help-block');
$I->see('Email is not a valid email address.', '.help-block');

$I->amGoingTo('submit signup form with correct email');
$signupPage->submit([
'username' => 'tester',
'email' => 'tester.email@example.com',
'password' => 'tester_password',
]);

$I->expectTo('see that user is created');
$I->seeRecord('common\models\UserModel', [
'username' => 'tester',
'email' => 'tester.email@example.com',
]);

$I->expectTo('see that user logged in');
$I->seeLink('Logout (tester)');
}
}

+ 0
- 59
tests/codeception/frontend/unit/models/ContactFormTest.php Visa fil

@@ -1,59 +0,0 @@
<?php

namespace tests\codeception\frontend\unit\models;

use Yii;
use tests\codeception\frontend\unit\TestCase;
use frontend\models\ContactForm;

class ContactFormTest extends TestCase
{

use \Codeception\Specify;

protected function setUp()
{
parent::setUp();
Yii::$app->mailer->fileTransportCallback = function ($mailer, $message) {
return 'testing_message.eml';
};
}

protected function tearDown()
{
unlink($this->getMessageFile());
parent::tearDown();
}

public function testContact()
{
$model = new ContactForm();

$model->attributes = [
'name' => 'Tester',
'email' => 'tester@example.com',
'subject' => 'very important letter subject',
'body' => 'body of current message',
];

$model->sendEmail('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';
}
}

+ 0
- 88
tests/codeception/frontend/unit/models/PasswordResetRequestFormTest.php Visa fil

@@ -1,88 +0,0 @@
<?php

namespace tests\codeception\frontend\models;

use Yii;
use tests\codeception\frontend\unit\DbTestCase;
use frontend\models\PasswordResetRequestForm;
use tests\codeception\common\fixtures\UserFixture;
use common\models\UserModel;
use Codeception\Specify;

class PasswordResetRequestFormTest extends DbTestCase
{
use Specify;

protected function setUp()
{
parent::setUp();

Yii::$app->mailer->fileTransportCallback = function ($mailer, $message) {
return 'testing_message.eml';
};
}

protected function tearDown()
{
@unlink($this->getMessageFile());

parent::tearDown();
}

public function testSendEmailWrongUser()
{
$this->specify('no user with such email, message should not be send', function () {

$model = new PasswordResetRequestForm();
$model->email = 'not-existing-email@example.com';

expect('email not send', $model->sendEmail())->false();

});

$this->specify('user is not active, message should not be send', function () {

$model = new PasswordResetRequestForm();
$model->email = $this->user[1]['email'];

expect('email not send', $model->sendEmail())->false();

});
}

public function testSendEmailCorrectUser()
{
$model = new PasswordResetRequestForm();
$model->email = $this->user[0]['email'];
$user = UserModel::findOne(['password_reset_token' => $this->user[0]['password_reset_token']]);

expect('email sent', $model->sendEmail())->true();
expect('user has valid token', $user->password_reset_token)->notNull();

$this->specify('message has correct format', function () use ($model) {

expect('message file exists', file_exists($this->getMessageFile()))->true();

$message = file_get_contents($this->getMessageFile());
expect('message "from" is correct', $message)->contains(Yii::$app->params['supportEmail']);
expect('message "to" is correct', $message)->contains($model->email);

});
}

public function fixtures()
{
return [
'user' => [
'class' => UserFixture::className(),
'dataFile' => '@tests/codeception/frontend/unit/fixtures/data/models/user.php'
],
];
}

private function getMessageFile()
{
return Yii::getAlias(Yii::$app->mailer->fileTransportPath) . '/testing_message.eml';
}

}

+ 0
- 44
tests/codeception/frontend/unit/models/ResetPasswordFormTest.php Visa fil

@@ -1,44 +0,0 @@
<?php

namespace tests\codeception\frontend\unit\models;

use tests\codeception\frontend\unit\DbTestCase;
use tests\codeception\common\fixtures\UserFixture;
use frontend\models\ResetPasswordForm;

class ResetPasswordFormTest extends DbTestCase
{

/**
* @expectedException \yii\base\InvalidParamException
*/
public function testResetWrongToken()
{
new ResetPasswordForm('notexistingtoken_1391882543');
}

/**
* @expectedException \yii\base\InvalidParamException
*/
public function testResetEmptyToken()
{
new ResetPasswordForm('');
}

public function testResetCorrectToken()
{
$form = new ResetPasswordForm($this->user[0]['password_reset_token']);
expect('password should be resetted', $form->resetPassword())->true();
}

public function fixtures()
{
return [
'user' => [
'class' => UserFixture::className(),
'dataFile' => '@tests/codeception/frontend/unit/fixtures/data/models/user.php'
],
];
}

}

+ 0
- 53
tests/codeception/frontend/unit/models/SignupFormTest.php Visa fil

@@ -1,53 +0,0 @@
<?php

namespace tests\codeception\frontend\unit\models;

use tests\codeception\frontend\unit\DbTestCase;
use tests\codeception\common\fixtures\UserFixture;
use Codeception\Specify;
use frontend\models\SignupForm;

class SignupFormTest extends DbTestCase
{

use Specify;

public function testCorrectSignup()
{
$model = new SignupForm([
'username' => 'some_username',
'email' => 'some_email@example.com',
'password' => 'some_password',
]);

$user = $model->signup();

$this->assertInstanceOf('common\models\UserModel', $user, 'user should be valid');

expect('username should be correct', $user->username)->equals('some_username');
expect('email should be correct', $user->email)->equals('some_email@example.com');
expect('password should be correct', $user->validatePassword('some_password'))->true();
}

public function testNotCorrectSignup()
{
$model = new SignupForm([
'username' => 'troy.becker',
'email' => 'nicolas.dianna@hotmail.com',
'password' => 'some_password',
]);

expect('username and email are in use, user should not be created', $model->signup())->null();
}

public function fixtures()
{
return [
'user' => [
'class' => UserFixture::className(),
'dataFile' => '@tests/codeception/frontend/unit/fixtures/data/models/user.php',
],
];
}

}

+ 122
- 11
tests/codeception/tests/_support/_generated/AcceptanceTesterActions.php Visa fil

@@ -1,4 +1,4 @@
<?php //[STAMP] b87684f4c0c75fc41e1f8fbea925ed7e
<?php //[STAMP] f5e217e705497504e225283d7e1648a2
namespace _generated;

// This class was automatically generated by build task
@@ -217,7 +217,7 @@ trait AcceptanceTesterActions
* // CSS button
* $I->click('#form input[type=submit]');
* // XPath
* $I->click('//form/*[@type=submit]');
* $I->click('//form/*[@type="submit"]');
* // link in context
* $I->click('Logout', '#nav');
* // using strict locator
@@ -265,7 +265,7 @@ trait AcceptanceTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::see()
*/
@@ -303,7 +303,7 @@ trait AcceptanceTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* @see \Codeception\Lib\InnerBrowser::see()
*/
public function see($text, $selector = null) {
@@ -340,7 +340,7 @@ trait AcceptanceTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::dontSee()
*/
@@ -376,7 +376,7 @@ trait AcceptanceTesterActions
* For checking the raw source code, use `seeInSource()`.
*
* @param string $text
* @param string $selector optional
* @param array|string $selector optional
* @see \Codeception\Lib\InnerBrowser::dontSee()
*/
public function dontSee($text, $selector = null) {
@@ -714,7 +714,7 @@ trait AcceptanceTesterActions
* ``` php
* <?php
* // to match root url
* $I->seeCurrentUrlMatches('~$/users/(\d+)~');
* $I->seeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -733,7 +733,7 @@ trait AcceptanceTesterActions
* ``` php
* <?php
* // to match root url
* $I->seeCurrentUrlMatches('~$/users/(\d+)~');
* $I->seeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -753,7 +753,7 @@ trait AcceptanceTesterActions
* ``` php
* <?php
* // to match root url
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -772,7 +772,7 @@ trait AcceptanceTesterActions
* ``` php
* <?php
* // to match root url
* $I->dontSeeCurrentUrlMatches('~$/users/(\d+)~');
* $I->dontSeeCurrentUrlMatches('~^/users/(\d+)~');
* ?>
* ```
*
@@ -792,7 +792,7 @@ trait AcceptanceTesterActions
*
* ``` php
* <?php
* $user_id = $I->grabFromCurrentUrl('~$/user/(\d+)/~');
* $user_id = $I->grabFromCurrentUrl('~^/user/(\d+)/~');
* $uri = $I->grabFromCurrentUrl();
* ?>
* ```
@@ -2124,6 +2124,33 @@ trait AcceptanceTesterActions
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
*
* @param $from
* @param $to
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween()
*/
public function canSeeResponseCodeIsBetween($from, $to) {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsBetween', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that response code is between a certain range. Between actually means [from <= CODE <= to]
*
* @param $from
* @param $to
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsBetween()
*/
public function seeResponseCodeIsBetween($from, $to) {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsBetween', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@@ -2163,6 +2190,90 @@ trait AcceptanceTesterActions
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 2xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful()
*/
public function canSeeResponseCodeIsSuccessful() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsSuccessful', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 2xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsSuccessful()
*/
public function seeResponseCodeIsSuccessful() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsSuccessful', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 3xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection()
*/
public function canSeeResponseCodeIsRedirection() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsRedirection', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code 3xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsRedirection()
*/
public function seeResponseCodeIsRedirection() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsRedirection', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 4xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError()
*/
public function canSeeResponseCodeIsClientError() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsClientError', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 4xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsClientError()
*/
public function seeResponseCodeIsClientError() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsClientError', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 5xx
* Conditional Assertion: Test won't be stopped on fail
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError()
*/
public function canSeeResponseCodeIsServerError() {
return $this->getScenario()->runStep(new \Codeception\Step\ConditionalAssertion('seeResponseCodeIsServerError', func_get_args()));
}
/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the response code is 5xx
* @see \Codeception\Lib\InnerBrowser::seeResponseCodeIsServerError()
*/
public function seeResponseCodeIsServerError() {
return $this->getScenario()->runStep(new \Codeception\Step\Assertion('seeResponseCodeIsServerError', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*

+ 1
- 1
tests/codeception/tests/_support/_generated/FunctionalTesterActions.php Visa fil

@@ -1,4 +1,4 @@
<?php //[STAMP] 87d7b73e5d70b2bf844f74223195c6a2
<?php //[STAMP] 0070dbf1b3210bcb46043261c4e6eca0
namespace _generated;

// This class was automatically generated by build task

+ 69
- 5
tests/codeception/tests/_support/_generated/UnitTesterActions.php Visa fil

@@ -1,4 +1,4 @@
<?php //[STAMP] d535fe5574036c99de30ed605e60bddb
<?php //[STAMP] c2c9446f63b7a0bf8b43e42b9b1b6f87
namespace _generated;

// This class was automatically generated by build task
@@ -23,13 +23,13 @@ trait UnitTesterActions
* Regular example:
* ```php
* <?php
* $I->assertEquals($element->getChildrenCount(), 5);
* $I->assertEquals(5, $element->getChildrenCount());
* ```
*
* Floating-point example:
* ```php
* <?php
* $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01);
* $I->assertEquals(0.3, $calculator->add(0.1, 0.2), 'Calculator should add the two numbers correctly.', 0.01);
* ```
*
* @param $expected
@@ -53,13 +53,13 @@ trait UnitTesterActions
* Regular example:
* ```php
* <?php
* $I->assertNotEquals($element->getChildrenCount(), 0);
* $I->assertNotEquals(0, $element->getChildrenCount());
* ```
*
* Floating-point example:
* ```php
* <?php
* $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01);
* $I->assertNotEquals(0.4, $calculator->add(0.1, 0.2), 'Calculator should add the two numbers correctly.', 0.01);
* ```
*
* @param $expected
@@ -323,6 +323,20 @@ trait UnitTesterActions
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the condition is NOT true (everything but true)
*
* @param $condition
* @param string $message
* @see \Codeception\Module\Asserts::assertNotTrue()
*/
public function assertNotTrue($condition, $message = null) {
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@@ -337,6 +351,20 @@ trait UnitTesterActions
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Checks that the condition is NOT false (everything but false)
*
* @param $condition
* @param string $message
* @see \Codeception\Module\Asserts::assertNotFalse()
*/
public function assertNotFalse($condition, $message = null) {
return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
@@ -537,9 +565,45 @@ trait UnitTesterActions
*
* @param $exception string or \Exception
* @param $callback
*
* @deprecated Use expectThrowable instead
* @see \Codeception\Module\Asserts::expectException()
*/
public function expectException($exception, $callback) {
return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args()));
}

/**
* [!] Method is generated. Documentation taken from corresponding module.
*
* Handles and checks throwables (Exceptions/Errors) called inside the callback function.
* Either throwable class name or throwable instance should be provided.
*
* ```php
* <?php
* $I->expectThrowable(MyThrowable::class, function() {
* $this->doSomethingBad();
* });
*
* $I->expectThrowable(new MyException(), function() {
* $this->doSomethingBad();
* });
* ```
* If you want to check message or throwable code, you can pass them with throwable instance:
* ```php
* <?php
* // will check that throwable MyError is thrown with "Don't do bad things" message
* $I->expectThrowable(new MyError("Don't do bad things"), function() {
* $this->doSomethingBad();
* });
* ```
*
* @param $throwable string or \Throwable
* @param $callback
* @see \Codeception\Module\Asserts::expectThrowable()
*/
public function expectThrowable($throwable, $callback) {
return $this->getScenario()->runStep(new \Codeception\Step\Action('expectThrowable', func_get_args()));
}
}

+ 0
- 26
tests/functional/MyNewScenarioCest.php Visa fil

@@ -1,26 +0,0 @@
<?php

class MyNewScenarioCest
{
public function _before(FunctionalTester $I)
{
}

public function _after(FunctionalTester $I)
{
}

// tests
public function tryToTest(FunctionalTester $I)
{
$I->amOnPage(['site/contact']);
/*$I->submitForm('#contact-form', []);
$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('<h1>Contact</h1>');
}
}

Laddar…
Avbryt
Spara