Pārlūkot izejas kodu

Tests fonctionnels

refactoring
Guillaume Bourgeois pirms 1 gada
vecāks
revīzija
ef963a9faf
4 mainītis faili ar 34 papildinājumiem un 6 dzēšanām
  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 Parādīt failu

@@ -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 Parādīt failu

@@ -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 Parādīt failu

@@ -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 Parādīt failu

@@ -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');

Notiek ielāde…
Atcelt
Saglabāt