ソースを参照

Test fonctionnels

refactoring
Guillaume Bourgeois 1年前
コミット
beb4e803ef
53個のファイルの変更6117行の追加80行の削除
  1. +5
    -3
      backend/views/layouts/header.php
  2. +5
    -5
      common/forms/ContactForm.php
  3. +2
    -2
      frontend/controllers/SiteController.php
  4. +6
    -6
      frontend/forms/SignupForm.php
  5. +1
    -0
      frontend/views/site/contact.php
  6. +1
    -0
      frontend/views/site/signup.php
  7. +3
    -1
      frontend/views/site/signup_confirm.php
  8. +1
    -1
      frontend/views/user/update.php
  9. +44
    -35
      frontend/web/css/screen.css
  10. +10
    -0
      frontend/web/sass/screen.scss
  11. +5
    -5
      producer/controllers/SiteController.php
  12. +8
    -3
      producer/views/layouts/main.php
  13. +1
    -1
      producer/views/site/contact.php
  14. +5
    -0
      producer/web/css/screen.css
  15. +1
    -0
      producer/web/sass/screen.scss
  16. +6
    -0
      producer/web/sass/site/_contact.scss
  17. +1
    -0
      tests/codeception.yml
  18. +2
    -0
      tests/codeception/common/fixtures/data/init_login.php
  19. +17
    -0
      tests/codeception/config/producer/acceptance.php
  20. +6
    -0
      tests/codeception/config/producer/config.php
  21. +18
    -0
      tests/codeception/config/producer/functional.php
  22. +16
    -0
      tests/codeception/config/producer/unit.php
  23. +0
    -14
      tests/codeception/frontend/_pages/AboutPage.php
  24. +26
    -0
      tests/codeception/frontend/_pages/UserProfilePage.php
  25. +14
    -3
      tests/codeception/frontend/functional/ContactCept.php
  26. +13
    -0
      tests/codeception/frontend/functional/PagesMentionsCgvCept.php
  27. +3
    -1
      tests/codeception/frontend/functional/SignupCept.php
  28. +28
    -0
      tests/codeception/frontend/functional/UserProfileCept.php
  29. +4
    -0
      tests/codeception/producer/.gitignore
  30. +23
    -0
      tests/codeception/producer/_bootstrap.php
  31. +2
    -0
      tests/codeception/producer/_output/.gitignore
  32. +26
    -0
      tests/codeception/producer/_pages/ContactPage.php
  33. +26
    -0
      tests/codeception/producer/_support/AcceptanceTester.php
  34. +26
    -0
      tests/codeception/producer/_support/FunctionalTester.php
  35. +26
    -0
      tests/codeception/producer/_support/UnitTester.php
  36. +2405
    -0
      tests/codeception/producer/_support/_generated/AcceptanceTesterActions.php
  37. +3114
    -0
      tests/codeception/producer/_support/_generated/FunctionalTesterActions.php
  38. +16
    -0
      tests/codeception/producer/_support/_generated/UnitTesterActions.php
  39. +28
    -0
      tests/codeception/producer/acceptance.suite.yml
  40. +2
    -0
      tests/codeception/producer/acceptance/_bootstrap.php
  41. +17
    -0
      tests/codeception/producer/codeception.yml
  42. +17
    -0
      tests/codeception/producer/functional.suite.yml
  43. +22
    -0
      tests/codeception/producer/functional/ContactCept.php
  44. +18
    -0
      tests/codeception/producer/functional/CreditCept.php
  45. +9
    -0
      tests/codeception/producer/functional/HomeCept.php
  46. +18
    -0
      tests/codeception/producer/functional/OrderHystoryCept.php
  47. +14
    -0
      tests/codeception/producer/functional/OrderOrderCept.php
  48. +3
    -0
      tests/codeception/producer/functional/_bootstrap.php
  49. +6
    -0
      tests/codeception/producer/unit.suite.yml
  50. +11
    -0
      tests/codeception/producer/unit/DbTestCase.php
  51. +11
    -0
      tests/codeception/producer/unit/TestCase.php
  52. +2
    -0
      tests/codeception/producer/unit/_bootstrap.php
  53. +23
    -0
      tests/codeception/producer/unit/fixtures/data/models/user.php

+ 5
- 3
backend/views/layouts/header.php ファイルの表示

@@ -36,15 +36,17 @@
* termes.
*/

use common\helpers\Price;
use common\logic\Producer\Producer\Wrapper\ProducerManager;
use common\logic\User\User\Wrapper\UserManager;
use yii\helpers\Html;
use common\helpers\GlobalParam;

use common\logic\Distribution\Distribution\Model\Distribution;
use common\logic\Producer\Producer\Model\Producer;
use common\logic\User\User\Model\User;

$userManager = $this->getUserManager();
$producerManager = $this->getProducerManager();
$userManager = UserManager::getInstance();
$producerManager = ProducerManager::getInstance();
$producer = GlobalParam::getCurrentProducer();

?>

+ 5
- 5
common/forms/ContactForm.php ファイルの表示

@@ -52,6 +52,7 @@ class ContactForm extends Model
public $subject;
public $body;
public $verifyCode;
public $isTest;

/**
* @inheritdoc
@@ -59,12 +60,12 @@ class ContactForm extends Model
public function rules()
{
return [
// name, email, subject and body are required
[['name', 'email', 'subject', 'body'], 'required', 'message' => 'Champs obligatoire'],
// email has to be a valid email address
['email', 'email', 'message' => 'Email incorrect'],
// verifyCode needs to be entered correctly
['verifyCode', 'captcha', 'message' => 'Veuillez recopier le code de vérification'],
['isTest', 'string'],
['verifyCode', 'captcha', 'message' => 'Veuillez recopier le code de vérification', 'when' => function($model) {
return $model->isTest != 'isTest';
}],
];
}

@@ -90,7 +91,6 @@ class ContactForm extends Model
*/
public function sendEmail($email)
{

return Yii::$app->mailer->compose([
'html' => 'contact-html',
'text' => 'contact-text'], [ 'content' => $this->body,

+ 2
- 2
frontend/controllers/SiteController.php ファイルの表示

@@ -395,7 +395,7 @@ class SiteController extends FrontendController
$signupForm->option_user_producer = 'user';
$returnUrl = $this->getRequest()->get('returnUrl', $this->getUrlManagerProducer()->createAbsoluteUrl(['site/index', 'slug_producer' => $producer->slug]));

if ($this->getUser()->isGuest) {
if ($this->getUserCurrent()->identity->isGuest) {
if ($loginForm->load($this->getRequest()->post()) && $loginForm->login()) {
if (!strlen($producer->code)) {
$producerManager->addUser(GlobalParam::getCurrentUser(), $producer);
@@ -406,7 +406,7 @@ class SiteController extends FrontendController

if ($signupForm->load($this->getRequest()->post())
&& ($user = $signupForm->signup())
&& $this->getUser()->login($user)) {
&& $this->getUserCurrent()->login($user)) {

$this->redirect($returnUrl);
}

+ 6
- 6
frontend/forms/SignupForm.php ファイルの表示

@@ -69,6 +69,7 @@ class SignupForm extends Model
// public $free_price ;
public $id_tax_rate_default;
public $verifyCode;
public $is_test;

/**
* @inheritdoc
@@ -119,21 +120,18 @@ class SignupForm extends Model
}, 'whenClient' => "function (attribute, value) {
return $('#option-producer').prop('checked') ;
}"],
['name_producer', 'string'],
[['name_producer', 'type', 'siret', 'is_test'], 'string'],
['name_producer', 'required', 'message' => 'Champs obligatoire', 'when' => function ($model) {
return $model->option_user_producer == 'producer';
}, 'whenClient' => "function (attribute, value) {
return $('#option-producer').prop('checked') ;
}"],
['type', 'string'],
['type', 'required', 'message' => 'Champs obligatoire', 'when' => function ($model) {
return $model->option_user_producer == 'producer';
}, 'whenClient' => "function (attribute, value) {
return $('#option-producer').prop('checked') ;
}"],
['siret', 'string'],
['siret', function ($attribute, $params) {

$siret = $this->$attribute;
$siret = str_replace(' ', '', $siret);

@@ -194,11 +192,13 @@ class SignupForm extends Model
$this->addError($attribute, 'Code incorrect');
}
}],
// ['free_price', 'number'],
//['free_price', 'number'],
['id_tax_rate_default', 'exist',
'targetClass' => TaxRate::className(),
'targetAttribute' => ['id_tax_rate_default' => 'id']],
['verifyCode', 'captcha', 'message' => 'Veuillez recopier le code de vérification'],
['verifyCode', 'captcha', 'message' => 'Veuillez recopier le code de vérification', 'when' => function($model) {
return $model->is_test != 'isTest';
}],
];
}


+ 1
- 0
frontend/views/site/contact.php ファイルの表示

@@ -69,6 +69,7 @@ $this->params['breadcrumbs'][] = $this->title;
<?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [
'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
]) ?>
<?= $form->field($model, 'isTest')->hiddenInput() ?>
<div class="form-group">
<?= Html::submitButton('Envoyer', ['class' => 'btn btn-primary', 'name' => 'contact-button']) ?>
</div>

+ 1
- 0
frontend/views/site/signup.php ファイルの表示

@@ -102,6 +102,7 @@ $this->params['breadcrumbs'][] = $this->title;
<?= $form->field($model, 'verifyCode')->widget(\yii\captcha\Captcha::className(), [
'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
]) ?>
<?= $form->field($model, 'is_test')->hiddenInput() ?>

<div class="form-group" id="buttons-signup">
<?= Html::submitButton("S'inscrire", ['class' => 'btn btn-primary', 'name' => 'signup-button']) ?>

+ 3
- 1
frontend/views/site/signup_confirm.php ファイルの表示

@@ -50,9 +50,11 @@ $userManager = UserManager::getInstance();
$urlRedirect = null;
if($userManager->isProducer($user)) {
$urlRedirect = $this->getUrlManagerBackend()->createAbsoluteUrl(['site/index']);
$redirectLabel = "Redirection vers votre tableau de bord ...";
}
elseif($producerRedirect) {
$urlRedirect = $this->getUrlManagerProducer()->createAbsoluteUrl(['site/index', 'slug_producer' => $producerRedirect->slug]);
$redirectLabel = "Redirection vers l'espace de votre producteur ...";
}

?>
@@ -63,7 +65,7 @@ elseif($producerRedirect) {
</div>

<?php if($urlRedirect): ?>
<p>Redirection dans 3 secondes ...</p>
<p><?= $redirectLabel ?></p>
<script>
window.setTimeout(function(){
window.location.href = "<?= $urlRedirect ?>";

+ 1
- 1
frontend/views/user/update.php ファイルの表示

@@ -69,7 +69,7 @@ $this->title = 'Mon profil' ;
<div class="clr"></div>
<div class="form-group">
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Modifier', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
<?= Html::submitButton($model->isNewRecord ? 'Create' : 'Modifier', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary', 'name' => 'user-profile-button']) ?>
</div>
<?php ActiveForm::end(); ?>
</div>

+ 44
- 35
frontend/web/css/screen.css ファイルの表示

@@ -791,20 +791,24 @@ ul li {
#form-signup #buttons-signup {
margin-top: 30px;
}
/* line 808, ../sass/screen.scss */
#form-signup .field-signupform-is_test {
display: none;
}

/* line 809, ../sass/screen.scss */
/* line 813, ../sass/screen.scss */
#col-left {
padding: 0px;
z-index: 15;
}
/* line 813, ../sass/screen.scss */
/* line 817, ../sass/screen.scss */
#col-left .affix {
width: 25%;
border-right: solid 1px #e0e0e0;
background-color: #FAFAFA;
height: 100%;
}
/* line 820, ../sass/screen.scss */
/* line 824, ../sass/screen.scss */
#col-left #link-home {
text-decoration: none;
font-size: 22px;
@@ -813,28 +817,28 @@ ul li {
padding: 10px;
background-color: white;
}
/* line 828, ../sass/screen.scss */
/* line 832, ../sass/screen.scss */
#col-left #link-home img {
height: 50px;
margin-bottom: 5px;
float: left;
}
/* line 834, ../sass/screen.scss */
/* line 838, ../sass/screen.scss */
#col-left #link-home .text {
padding-left: 62px;
}
/* line 837, ../sass/screen.scss */
/* line 841, ../sass/screen.scss */
#col-left #link-home .text .bap {
font-family: "comfortaalight";
font-size: 24px;
}
/* line 842, ../sass/screen.scss */
/* line 846, ../sass/screen.scss */
#col-left #link-home .text .plateforme {
font-size: 17px;
font-family: "myriadpro-light";
color: #FF7F00;
}
/* line 850, ../sass/screen.scss */
/* line 854, ../sass/screen.scss */
#col-left h2 {
font-family: "myriadpro-regular";
color: black;
@@ -842,37 +846,37 @@ ul li {
margin-bottom: 10px;
padding: 15px 0px 5px 15px;
}
/* line 858, ../sass/screen.scss */
/* line 862, ../sass/screen.scss */
#col-left #links {
background-color: white;
margin-bottom: 20px;
}
/* line 864, ../sass/screen.scss */
/* line 868, ../sass/screen.scss */
#col-left #links ul li a {
text-align: center;
border-right: solid 1px #e0e0e0;
}
/* line 868, ../sass/screen.scss */
/* line 872, ../sass/screen.scss */
#col-left #links ul li a:hover {
background-color: #FF7F00;
color: white;
}
/* line 874, ../sass/screen.scss */
/* line 878, ../sass/screen.scss */
#col-left #links ul li:last-child a {
border-right: 0px none;
}
/* line 884, ../sass/screen.scss */
/* line 888, ../sass/screen.scss */
#col-left #producers nav.nav-producers ul li a {
padding-left: 50px;
height: 40px;
}
/* line 890, ../sass/screen.scss */
/* line 894, ../sass/screen.scss */
#col-left #producers nav.nav-producers ul li.active a {
background-color: #FF7F00;
position: relative;
color: white;
}
/* line 895, ../sass/screen.scss */
/* line 899, ../sass/screen.scss */
#col-left #producers nav.nav-producers ul li.active a:after {
right: -40px;
top: 50%;
@@ -887,18 +891,18 @@ ul li {
border-width: 20px;
margin-top: -20px;
}
/* line 914, ../sass/screen.scss */
/* line 918, ../sass/screen.scss */
#col-left ul {
list-style-type: none;
margin: 0px;
padding: 0px;
}
/* line 918, ../sass/screen.scss */
/* line 922, ../sass/screen.scss */
#col-left ul li {
margin: 0px;
padding: 0px;
}
/* line 921, ../sass/screen.scss */
/* line 925, ../sass/screen.scss */
#col-left ul li a {
text-decoration: none;
font-family: "comfortaaregular";
@@ -909,18 +913,18 @@ ul li {
display: block;
color: black;
}
/* line 931, ../sass/screen.scss */
/* line 935, ../sass/screen.scss */
#col-left ul li a span.name, #col-left ul li a span.wording {
display: none;
}
/* line 938, ../sass/screen.scss */
/* line 942, ../sass/screen.scss */
#col-left p {
padding: 20px;
padding-top: 0px;
color: gray;
}

/* line 946, ../sass/screen.scss */
/* line 950, ../sass/screen.scss */
#content .header-title {
height: 79px;
padding: 20px 20px;
@@ -935,7 +939,7 @@ ul li {
-webkit-box-shadow: 0px 0px 8px #e0e0e0;
box-shadow: 0px 0px 8px #e0e0e0;
}
/* line 958, ../sass/screen.scss */
/* line 962, ../sass/screen.scss */
#content .header-title h1 {
color: black;
font-family: "myriadpro-regular";
@@ -943,7 +947,7 @@ ul li {
font-size: 25px;
text-transform: uppercase;
}
/* line 966, ../sass/screen.scss */
/* line 970, ../sass/screen.scss */
#content .header-title h2 {
color: gray;
text-transform: none;
@@ -952,16 +956,16 @@ ul li {
line-height: 20px;
}

/* line 977, ../sass/screen.scss */
/* line 981, ../sass/screen.scss */
.header-producer {
z-index: 1;
}
/* line 979, ../sass/screen.scss */
/* line 983, ../sass/screen.scss */
.header-producer #block-main-img {
height: 144px;
overflow: hidden;
}
/* line 983, ../sass/screen.scss */
/* line 987, ../sass/screen.scss */
.header-producer #block-main-img #main-img {
width: 100%;
height: auto;
@@ -971,7 +975,7 @@ ul li {
-webkit-border-radius: 0px;
border-radius: 0px;
}
/* line 992, ../sass/screen.scss */
/* line 996, ../sass/screen.scss */
.header-producer h1 {
font-family: "comfortaaregular";
text-align: center;
@@ -979,23 +983,23 @@ ul li {
top: 30px;
left: 40px;
}
/* line 999, ../sass/screen.scss */
/* line 1003, ../sass/screen.scss */
.header-producer h1 span {
background-color: rgba(255, 255, 255, 0.8);
padding: 10px 30px;
border: dotted 1px black;
}

/* line 1010, ../sass/screen.scss */
/* line 1014, ../sass/screen.scss */
nav#menu-producer {
border-bottom: solid 1px #e0e0e0;
}
/* line 1014, ../sass/screen.scss */
/* line 1018, ../sass/screen.scss */
nav#menu-producer ul li {
padding: 0px;
margin: 0px;
}
/* line 1017, ../sass/screen.scss */
/* line 1021, ../sass/screen.scss */
nav#menu-producer ul li a {
border-right: solid 1px #e0e0e0;
text-decoration: none;
@@ -1003,29 +1007,34 @@ nav#menu-producer ul li a {
-webkit-border-radius: 0px;
border-radius: 0px;
}
/* line 1022, ../sass/screen.scss */
/* line 1026, ../sass/screen.scss */
nav#menu-producer ul li a:hover {
background-color: #FF7F00;
color: white;
}

/* line 1032, ../sass/screen.scss */
/* line 1036, ../sass/screen.scss */
.site-contact .col-lg-5 {
margin: 0px auto;
float: none;
}
/* line 1037, ../sass/screen.scss */
/* line 1041, ../sass/screen.scss */
.site-contact #contact-phone {
font-family: "capsuularegular";
font-size: 20px;
line-height: 25px;
}

/* line 1046, ../sass/screen.scss */
/* line 1050, ../sass/screen.scss */
#site-prices .panel p {
padding-bottom: 0px;
}

/* line 1057, ../sass/screen.scss */
#contact-form .field-contactform-istest {
display: none;
}

/**
Copyright distrib (2018)


+ 10
- 0
frontend/web/sass/screen.scss ファイルの表示

@@ -804,6 +804,10 @@ $max-width-form: 500px ;
#buttons-signup {
margin-top: 30px;
}

.field-signupform-is_test {
display: none;
}
}

#col-left {
@@ -1049,6 +1053,12 @@ nav#menu-producer {
}
}

#contact-form {
.field-contactform-istest {
display: none;
}
}

@import "_order_system.scss" ;
@import "_responsive.scss" ;


+ 5
- 5
producer/controllers/SiteController.php ファイルの表示

@@ -178,12 +178,12 @@ class SiteController extends ProducerBaseController
$this->setFlash('error', 'Il y a eu une erreur lors de l\'envoi de votre message.');
}

return $this->refresh();
} else {
return $this->render('contact', [
'model' => $model,
]);
$model = new ContactForm();
}

return $this->render('contact', [
'model' => $model,
]);
}

/**

+ 8
- 3
producer/views/layouts/main.php ファイルの表示

@@ -45,6 +45,7 @@ use yii\helpers\Html;
\common\assets\CommonAsset::register($this);
\producer\assets\AppAsset::register($this);

$userCurrent = GlobalParam::getCurrentUser();
$producer = $this->context->getProducerCurrent();
if (!Yii::$app->user->isGuest) {
$userProducer = UserProducer::findOne(['id_user' => GlobalParam::getCurrentUserId(), 'id_producer' => $producer->id]);
@@ -148,10 +149,14 @@ if (!Yii::$app->user->isGuest) {
$credit = ' <span class="label label-' . $labelType . '">' . number_format($userProducer->credit, 2) . ' €</span>';
}

$countSubcriptions = $this->getSubscriptionManager()->countSubscriptionsByUser(
GlobalParam::getCurrentUser(),
$countSubcriptions = 0;
if($userCurrent) {
$countSubcriptions = $this->getSubscriptionManager()->countSubscriptionsByUser(
$userCurrent,
GlobalParam::getCurrentProducer()
);
);
}

$labelSubscription = $countSubcriptions > 0 ? 'success' : 'default';

$countOrders = Order::find()

+ 1
- 1
producer/views/site/contact.php ファイルの表示

@@ -55,7 +55,7 @@ $this->setTitle('Contact');
<?php echo $form->field($model, 'verifyCode')->widget(yii\captcha\Captcha::className(), [
'template' => '<div class="row"><div class="col-md-12">{image}</div><div class="col-md-12">{input}</div></div>',
]); ?>
<?= $form->field($model, 'isTest')->hiddenInput() ?>
<div class="form-group">
<?= Html::submitButton('Envoyer', ['class' => 'btn btn-primary', 'name' => 'contact-button']) ?>
</div>

+ 5
- 0
producer/web/css/screen.css ファイルの表示

@@ -678,6 +678,11 @@ termes.
font-weight: bold;
}

/* line 3, ../sass/site/_contact.scss */
#contact-form .field-contactform-istest {
display: none;
}

/**
Copyright distrib (2018)


+ 1
- 0
producer/web/sass/screen.scss ファイルの表示

@@ -40,6 +40,7 @@ termes.
@import "_layout.scss";
@import "site/_index.scss";
@import "site/_credit_history.scss";
@import "site/_contact.scss";
@import "order/_form.scss";
@import "order/_history.scss";
@import "order/_order.scss";

+ 6
- 0
producer/web/sass/site/_contact.scss ファイルの表示

@@ -0,0 +1,6 @@

#contact-form {
.field-contactform-istest {
display: none;
}
}

+ 1
- 0
tests/codeception.yml ファイルの表示

@@ -3,6 +3,7 @@ include:
- codeception/console
- codeception/backend
- codeception/frontend
- codeception/producer

paths:
log: codeception/_output

+ 2
- 0
tests/codeception/common/fixtures/data/init_login.php ファイルの表示

@@ -10,5 +10,7 @@ return [
'created_at' => '1392559490',
'updated_at' => '1392559490',
'email' => 'sfriesen@jenkins.info',
'id_producer' => 32,
'status' => 11
],
];

+ 17
- 0
tests/codeception/config/producer/acceptance.php ファイルの表示

@@ -0,0 +1,17 @@
<?php
defined('YII_APP_BASE_PATH') or define('YII_APP_BASE_PATH', dirname(dirname(dirname(dirname(__DIR__)))));

/**
* Application configuration for frontend acceptance tests
*/
return yii\helpers\ArrayHelper::merge(
require(YII_APP_BASE_PATH . '/common/config/main.php'),
require(YII_APP_BASE_PATH . '/common/config/test-local.php'),
require(YII_APP_BASE_PATH . '/producer/config/main.php'),
require(YII_APP_BASE_PATH . '/producer/config/main-local.php'),
require(dirname(__DIR__) . '/config.php'),
require(dirname(__DIR__) . '/acceptance.php'),
require(__DIR__ . '/config.php'),
[
]
);

+ 6
- 0
tests/codeception/config/producer/config.php ファイルの表示

@@ -0,0 +1,6 @@
<?php
/**
* Application configuration for all frontend test types
*/

return [];

+ 18
- 0
tests/codeception/config/producer/functional.php ファイルの表示

@@ -0,0 +1,18 @@
<?php
$_SERVER['SCRIPT_FILENAME'] = PRODUCER_ENTRY_FILE;
$_SERVER['SCRIPT_NAME'] = PRODUCER_ENTRY_URL;

/**
* Application configuration for frontend functional tests
*/
return yii\helpers\ArrayHelper::merge(
require(YII_APP_BASE_PATH . '/common/config/main.php'),
require(YII_APP_BASE_PATH . '/common/config/test-local.php'),
require(YII_APP_BASE_PATH . '/producer/config/main.php'),
require(YII_APP_BASE_PATH . '/producer/config/main-local.php'),
require(dirname(__DIR__) . '/config.php'),
require(dirname(__DIR__) . '/functional.php'),
require(__DIR__ . '/config.php'),
[
]
);

+ 16
- 0
tests/codeception/config/producer/unit.php ファイルの表示

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

/**
* Application configuration for frontend unit tests
*/
return yii\helpers\ArrayHelper::merge(
require(YII_APP_BASE_PATH . '/common/config/main.php'),
require(YII_APP_BASE_PATH . '/common/config/test-local.php'),
require(YII_APP_BASE_PATH . '/producer/config/main.php'),
require(YII_APP_BASE_PATH . '/producer/config/main-local.php'),
require(dirname(__DIR__) . '/config.php'),
require(dirname(__DIR__) . '/unit.php'),
require(__DIR__ . '/config.php'),
[
]
);

+ 0
- 14
tests/codeception/frontend/_pages/AboutPage.php ファイルの表示

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

namespace tests\codeception\frontend\_pages;

use tests\codeception\common\_pages\MyBasePage;

/**
* Represents about page
* @property \codeception_frontend\AcceptanceTester|\codeception_frontend\FunctionalTester $actor
*/
class AboutPage extends MyBasePage
{
public $route = 'site/about';
}

+ 26
- 0
tests/codeception/frontend/_pages/UserProfilePage.php ファイルの表示

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

namespace tests\codeception\frontend\_pages;

use tests\codeception\common\_pages\MyBasePage;

/**
* Represents contact page
* @property \codeception_frontend\AcceptanceTester|\codeception_frontend\FunctionalTester $actor
*/
class UserProfilePage extends MyBasePage
{
public $route = 'user/update';

/**
* @param array $contactData
*/
public function submit(array $contactData)
{
foreach ($contactData as $field => $value) {
$inputType = $field === 'address' ? 'textarea' : 'input';
$this->actor->fillField($inputType . '[name="User[' . $field . ']"]', $value);
}
$this->actor->click('user-profile-button');
}
}

+ 14
- 3
tests/codeception/frontend/functional/ContactCept.php ファイルの表示

@@ -1,11 +1,22 @@
<?php

use tests\codeception\frontend\_pages\ContactPage;
use tests\codeception\frontend\FunctionalTester;

/* @var $scenario Codeception\Scenario */

$I = new FunctionalTester($scenario);
$contactPage = ContactPage::openBy($I);

$I->amOnPage('site/contact');
$I->wantTo("m'assurer que le formulaire de contact fonctionne");
$I->see('Me contacter', 'h1');

$I->wantTo("m'assurer que la page de contact s'affiche");
$I->see('Me contacter', 'h1');
$I->amGoingTo("envoyer un message");
$contactPage->submit([
'name' => 'Test',
'email' => 'test@opendistrib.net',
'subject' => 'Sujet',
'body' => 'Message',
'isTest' => 'isTest'
]);
$I->see('Votre message a bien été envoyé', '.alert-success');

+ 13
- 0
tests/codeception/frontend/functional/PagesMentionsCgvCept.php ファイルの表示

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

/* @var $scenario Codeception\Scenario */

$I = new FunctionalTester($scenario);
$I->wantTo("m'assurer que les pages Mentions et CGV s'affichent");

$I->amOnPage('/site/mentions');
$I->see('Mentions légales', 'h1');

$I->amOnPage('/site/cgv');
$I->see('Conditions générales de service', 'h1');

+ 3
- 1
tests/codeception/frontend/functional/SignupCept.php ファイルの表示

@@ -21,6 +21,7 @@ $signupPage->submit([
'phone' => '0600000000',
'option_user_producer' => 'user',
'id_producer' => '32',
'is_test' => 'isTest'
]);
$I->see('Inscription confirmée', 'h1');

@@ -43,6 +44,7 @@ $signupPage->submit([
'postcode' => '25000',
'city' => 'Besançon',
'id_tax_rate_default' => '1',
'cgv' => '1'
'cgv' => '1',
'is_test' => 'isTest'
]);
$I->see('Inscription confirmée', 'h1');

+ 28
- 0
tests/codeception/frontend/functional/UserProfileCept.php ファイルの表示

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

use tests\codeception\common\_pages\LoginPage;
use tests\codeception\frontend\_pages\SignupPage;
use tests\codeception\frontend\_pages\UserProfilePage;
use tests\codeception\frontend\FunctionalTester;

/* @var $scenario Codeception\Scenario */

$I = new FunctionalTester($scenario);
$I->amLoggedInAs(1);
$userProfilePage = UserProfilePage::openBy($I);

$I->wantTo("m'assurer que l'édition du profil de l'utilisateur fonctionne");
$I->see('Mon profil', 'h1');

$I->amGoingTo("modifier mon profil");
$userProfilePage->submit([
'lastname' => 'Nom',
'name' => 'Prénom',
'phone' => '0600000000',
'email' => 'test@opendistrib.net',
'address' => 'Adresse',
'password_old' => 'password_0',
'password_new' => 'newpassword',
'password_new_confirm' => 'newpassword',
]);
$I->see('Votre profil a bien été modifié', '.alert-success');

+ 4
- 0
tests/codeception/producer/.gitignore ファイルの表示

@@ -0,0 +1,4 @@
# these files are auto generated by codeception build
/unit/UnitTester.php
/functional/FunctionalTester.php
/acceptance/AcceptanceTester.php

+ 23
- 0
tests/codeception/producer/_bootstrap.php ファイルの表示

@@ -0,0 +1,23 @@
<?php
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'test');

defined('YII_APP_BASE_PATH') or define('YII_APP_BASE_PATH', dirname(dirname(dirname(__DIR__))));

defined('PRODUCER_ENTRY_URL') or define('PRODUCER_ENTRY_URL', parse_url(\Codeception\Configuration::config()['config']['test_entry_url'], PHP_URL_PATH));
defined('PRODUCER_ENTRY_FILE') or define('PRODUCER_ENTRY_FILE', YII_APP_BASE_PATH . '/producer/web/index-test.php');

require_once(YII_APP_BASE_PATH . '/vendor/autoload.php');
require_once(YII_APP_BASE_PATH . '/vendor/yiisoft/yii2/Yii.php');
require_once(YII_APP_BASE_PATH . '/common/config/bootstrap.php');
require_once(YII_APP_BASE_PATH . '/producer/config/bootstrap.php');

// set correct script paths

// the entry script file path for functional and acceptance tests
$_SERVER['SCRIPT_FILENAME'] = PRODUCER_ENTRY_URL;
$_SERVER['SCRIPT_NAME'] = PRODUCER_ENTRY_FILE;
$_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__)));

+ 2
- 0
tests/codeception/producer/_output/.gitignore ファイルの表示

@@ -0,0 +1,2 @@
*
!.gitignore

+ 26
- 0
tests/codeception/producer/_pages/ContactPage.php ファイルの表示

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

namespace tests\codeception\producer\_pages;

use tests\codeception\common\_pages\MyBasePage;

/**
* Represents contact page
* @property \codeception_frontend\AcceptanceTester|\codeception_frontend\FunctionalTester $actor
*/
class ContactPage extends MyBasePage
{
public $route = 'demo/site/contact';

/**
* @param array $contactData
*/
public function submit(array $contactData)
{
foreach ($contactData as $field => $value) {
$inputType = $field === 'body' ? 'textarea' : 'input';
$this->actor->fillField($inputType . '[name="ContactForm[' . $field . ']"]', $value);
}
$this->actor->click('contact-button');
}
}

+ 26
- 0
tests/codeception/producer/_support/AcceptanceTester.php ファイルの表示

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

/**
* 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 AcceptanceTester extends \Codeception\Actor
{
use _generated\AcceptanceTesterActions;

/**
* Define custom actions here
*/
}

+ 26
- 0
tests/codeception/producer/_support/FunctionalTester.php ファイルの表示

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

/**
* 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 FunctionalTester extends \Codeception\Actor
{
use _generated\FunctionalTesterActions;

/**
* Define custom actions here
*/
}

+ 26
- 0
tests/codeception/producer/_support/UnitTester.php ファイルの表示

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

/**
* 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
*/
}

+ 2405
- 0
tests/codeception/producer/_support/_generated/AcceptanceTesterActions.php
ファイル差分が大きすぎるため省略します
ファイルの表示


+ 3114
- 0
tests/codeception/producer/_support/_generated/FunctionalTesterActions.php
ファイル差分が大きすぎるため省略します
ファイルの表示


+ 16
- 0
tests/codeception/producer/_support/_generated/UnitTesterActions.php ファイルの表示

@@ -0,0 +1,16 @@
<?php //[STAMP] e543475a72b3c2b2bbb166e62bf94035
namespace tests\codeception\producer\_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();

}

+ 28
- 0
tests/codeception/producer/acceptance.suite.yml ファイルの表示

@@ -0,0 +1,28 @@
# Codeception Test Suite Configuration

# suite for acceptance tests.
# perform tests in browser using the Selenium-like tools.
# powered by Mink (http://mink.behat.org).
# (tip: that's what your customer will see).
# (tip: test your ajax and javascript by one of Mink drivers).

# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.

class_name: AcceptanceTester
modules:
enabled:
- PhpBrowser
- tests\codeception\common\_support\FixtureHelper
# you can use WebDriver instead of PhpBrowser to test javascript and ajax.
# This will require you to install selenium. See http://codeception.com/docs/04-AcceptanceTests#Selenium
# "restart" option is used by the WebDriver to start each time per test-file new session and cookies,
# it is useful if you want to login in your app in each test.
# - WebDriver
config:
PhpBrowser:
# PLEASE ADJUST IT TO THE ACTUAL ENTRY POINT WITHOUT PATH INFO
url: http://localhost:8080
# WebDriver:
# url: http://localhost:8080
# browser: firefox
# restart: true

+ 2
- 0
tests/codeception/producer/acceptance/_bootstrap.php ファイルの表示

@@ -0,0 +1,2 @@
<?php
new yii\web\Application(require(dirname(dirname(__DIR__)) . '/config/producer/acceptance.php'));

+ 17
- 0
tests/codeception/producer/codeception.yml ファイルの表示

@@ -0,0 +1,17 @@
namespace: tests\codeception\producer
actor: Tester
paths:
tests: .
log: _output
data: _data
helpers: _support
settings:
bootstrap: _bootstrap.php
suite_class: \PHPUnit_Framework_TestSuite
colors: true
memory_limit: 1024M
log: true
config:
# the entry script URL (with host info) for functional and acceptance tests
# PLEASE ADJUST IT TO THE ACTUAL ENTRY SCRIPT URL
test_entry_url: http://localhost:8080/producer/web/index-test.php

+ 17
- 0
tests/codeception/producer/functional.suite.yml ファイルの表示

@@ -0,0 +1,17 @@
# Codeception Test Suite Configuration

# suite for functional (integration) tests.
# emulate web requests and make application process them.
# (tip: better to use with frameworks).

# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.
#basic/web/index.php
class_name: FunctionalTester
modules:
enabled:
- Filesystem
- Yii2
- tests\codeception\common\_support\FixtureHelper
config:
Yii2:
configFile: '../config/producer/functional.php'

+ 22
- 0
tests/codeception/producer/functional/ContactCept.php ファイルの表示

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

use tests\codeception\producer\_pages\ContactPage;
use tests\codeception\producer\FunctionalTester;

/* @var $scenario Codeception\Scenario */

$I = new FunctionalTester($scenario);
$contactPage = ContactPage::openBy($I);

$I->wantTo("m'assurer que le formulaire de contact s'affiche et fonctionne");
$I->see('Contact', 'h2');

$I->amGoingTo("envoyer un message");
$contactPage->submit([
'name' => 'Test',
'email' => 'test@opendistrib.net',
'subject' => 'Sujet',
'body' => 'Message',
'isTest' => 'isTest'
]);
$I->see('Votre message a bien été envoyé');

+ 18
- 0
tests/codeception/producer/functional/CreditCept.php ファイルの表示

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

use tests\codeception\producer\FunctionalTester;

/* @var $scenario Codeception\Scenario */

$I = new FunctionalTester($scenario);

$I->wantTo("m'assurer que les pages de la section Crédit s'affichent correctement");
$I->amLoggedInAs(1);

$I->amOnPage('/demo/credit/history');
$I->see('Crédit', 'h2');

$I->amOnPage('/demo/credit/add');
$I->see('Créditer mon compte', 'h2');



+ 9
- 0
tests/codeception/producer/functional/HomeCept.php ファイルの表示

@@ -0,0 +1,9 @@
<?php
use tests\codeception\producer\FunctionalTester;

/* @var $scenario Codeception\Scenario */

$I = new FunctionalTester($scenario);
$I->wantTo("m'assurer que la page d'accueil s'affiche");
$I->amOnPage('demo/site/index');
$I->see('Accueil', 'h2');

+ 18
- 0
tests/codeception/producer/functional/OrderHystoryCept.php ファイルの表示

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

use tests\codeception\producer\FunctionalTester;

/* @var $scenario Codeception\Scenario */

$I = new FunctionalTester($scenario);

$I->wantTo("m'assurer que l'historique des commandes s'affiche");
$I->amLoggedInAs(1);

$I->amOnPage('/demo/order/history');
$I->see('Mes commandes', 'h2');

$I->amOnPage('/demo/order/history?type=passed');
$I->see('Mes commandes', 'h2');



+ 14
- 0
tests/codeception/producer/functional/OrderOrderCept.php ファイルの表示

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

use tests\codeception\producer\FunctionalTester;

/* @var $scenario Codeception\Scenario */

$I = new FunctionalTester($scenario);

$I->wantTo("m'assurer que le tunnel de commande fonctionne");
$I->amLoggedInAs(1);

$I->amOnPage('/demo/order/order');
$I->see('Commander', 'h2');


+ 3
- 0
tests/codeception/producer/functional/_bootstrap.php ファイルの表示

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

new yii\web\Application(require(dirname(dirname(__DIR__)) . '/config/producer/functional.php'));

+ 6
- 0
tests/codeception/producer/unit.suite.yml ファイルの表示

@@ -0,0 +1,6 @@
# Codeception Test Suite Configuration

# suite for unit (internal) tests.
# RUN `build` COMMAND AFTER ADDING/REMOVING MODULES.

class_name: UnitTester

+ 11
- 0
tests/codeception/producer/unit/DbTestCase.php ファイルの表示

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

namespace tests\codeception\producer\unit;

/**
* @inheritdoc
*/
class DbTestCase extends \yii\codeception\DbTestCase
{
public $appConfig = '@tests/codeception/config/producer/unit.php';
}

+ 11
- 0
tests/codeception/producer/unit/TestCase.php ファイルの表示

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

namespace tests\codeception\producer\unit;

/**
* @inheritdoc
*/
class TestCase extends \yii\codeception\TestCase
{
public $appConfig = '@tests/codeception/config/producer/unit.php';
}

+ 2
- 0
tests/codeception/producer/unit/_bootstrap.php ファイルの表示

@@ -0,0 +1,2 @@
<?php
// Here you can initialize variables that will for your tests

+ 23
- 0
tests/codeception/producer/unit/fixtures/data/models/user.php ファイルの表示

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

return [
[
'username' => 'okirlin',
'auth_key' => 'iwTNae9t34OmnK6l4vT4IeaTk-YWI2Rv',
'password_hash' => '$2y$13$CXT0Rkle1EMJ/c1l5bylL.EylfmQ39O5JlHJVFpNn618OUS1HwaIi',
'password_reset_token' => 't5GU9NwpuGYSfb7FEZMAxqtuz2PkEvv_' . time(),
'created_at' => '1391885313',
'updated_at' => '1391885313',
'email' => 'brady.renner@rutherford.com',
],
[
'username' => 'troy.becker',
'auth_key' => 'EdKfXrx88weFMV0vIxuTMWKgfK2tS3Lp',
'password_hash' => '$2y$13$g5nv41Px7VBqhS3hVsVN2.MKfgT3jFdkXEsMC4rQJLfaMa7VaJqL2',
'password_reset_token' => '4BSNyiZNAuxjs5Mty990c47sVrgllIi_' . time(),
'created_at' => '1391885313',
'updated_at' => '1391885313',
'email' => 'nicolas.dianna@hotmail.com',
'status' => '0',
],
];

読み込み中…
キャンセル
保存