Parcourir la source

Tests fonctionnels

refactoring
Guillaume Bourgeois il y a 1 an
Parent
révision
ef963a9faf
4 fichiers modifiés avec 34 ajouts et 6 suppressions
  1. +11
    -5
      producer/views/subscription/index.php
  2. +12
    -0
      tests/codeception/backend/functional/DashboardCept.php
  3. +1
    -1
      tests/codeception/common/fixtures/data/init_login.php
  4. +10
    -0
      tests/codeception/producer/functional/SubscriptionCept.php

+ 11
- 5
producer/views/subscription/index.php Voir le fichier

@@ -37,13 +37,16 @@ termes.
*/

use common\logic\PointSale\PointSale\Model\PointSale;
use common\logic\Producer\Producer\Wrapper\ProducerManager;
use common\logic\Product\Product\Model\Product;
use common\logic\Product\Product\Wrapper\ProductManager;
use yii\helpers\Html;
use yii\grid\GridView;
use common\helpers\GlobalParam;
use yii\helpers\ArrayHelper;

$producerManager = $this->getProducerManager();
$producerManager = ProducerManager::getInstance();
$productManager = ProductManager::getInstance();

$this->setTitle('Abonnements') ;
$this->addButton(['label' => '<span class="glyphicon glyphicon-plus"></span> Ajouter', 'url' => 'subscription/form', 'class' => 'btn btn-primary']) ;
@@ -53,12 +56,12 @@ $columns = [
'attribute' => 'product_name',
'label' => 'Produits',
'format' => 'raw',
'value' => function($model) {
'value' => function($model) use ($productManager) {
$html = '' ;
foreach($model->productSubscription as $productSubscription)
{
if(isset($productSubscription->product)) {
$html .= Html::encode($productSubscription->product->name).' ('.($productSubscription->quantity * Product::$unitsArray[$productSubscription->product->unit]['coefficient']) . '&nbsp'. Product::strUnit($productSubscription->product->unit, 'wording_short').')<br />' ;
if(isset($productSubscription->product) && $productSubscription->product) {
$html .= Html::encode($productSubscription->product->name).' ('.($productSubscription->quantity * Product::$unitsArray[$productSubscription->product->unit]['coefficient']) . '&nbsp'. $productManager->strUnit($productSubscription->product->unit, 'wording_short').')<br />' ;
}
else {
$html .= 'Produit non défini<br />' ;
@@ -79,7 +82,10 @@ $columns = [
'format' => 'raw',
'filter' => ArrayHelper::map(PointSale::find()->where(['id_producer' => GlobalParam::getCurrentProducerId()])->asArray()->all(), 'id', 'name'),
'value' => function($model) {
return Html::encode($model->pointSale->name) ;
if($model->pointSale) {
return Html::encode($model->pointSale->name) ;
}
return '';
}
],
[

+ 12
- 0
tests/codeception/backend/functional/DashboardCept.php Voir le fichier

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

use tests\codeception\backend\FunctionalTester;

/* @var $scenario Codeception\Scenario */

$I = new FunctionalTester($scenario);
$I->wantTo("m'assurer que le tableau de bord s'affiche");

$I->amLoggedInAs(1);
$I->amOnPage('/site/index');
$I->see("Tableau de bord");

+ 1
- 1
tests/codeception/common/fixtures/data/init_login.php Voir le fichier

@@ -11,6 +11,6 @@ return [
'updated_at' => '1392559490',
'email' => 'sfriesen@jenkins.info',
'id_producer' => 32,
'status' => 11
'status' => 13
],
];

+ 10
- 0
tests/codeception/producer/functional/SubscriptionCept.php Voir le fichier

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

/* @var $scenario Codeception\Scenario */

$I = new FunctionalTester($scenario);
$I->wantTo("m'assurer que la page des abonnements s'affiche");
$I->amLoggedInAs(1);
$I->amOnPage('demo/subscription/index');
$I->see('Abonnements', 'h2');

Chargement…
Annuler
Enregistrer