51e6872d
Mihail
add custom test f...
|
1
2
|
<?php
namespace tests\unit;
|
ad2e91f7
Mihail
move multyparser ...
|
3
|
use common\components\CustomArrayHelper;
|
51e6872d
Mihail
add custom test f...
|
4
5
6
7
8
9
10
11
12
13
14
15
16
|
use common\components\UserStore;
use Yii;
class CrossesParsingTest extends \Codeception\TestCase\Test
{
/**
* @var \UnitTester
*/
protected $tester;
private $options;
private $file_path;
|
884c04ad
Mihail
fixed issues with...
|
17
|
private $data = [];
|
51e6872d
Mihail
add custom test f...
|
18
19
20
21
|
public function _before()
{
$this->options[ 'mode' ] = 'crosses';
|
884c04ad
Mihail
fixed issues with...
|
22
|
|
884c04ad
Mihail
fixed issues with...
|
23
|
|
51e6872d
Mihail
add custom test f...
|
24
25
26
27
|
$this->file_path = Yii::getAlias('@data_parser') . '\crosses\test1.csv';
}
|
ad2e91f7
Mihail
move multyparser ...
|
28
|
public function testCrossesConfiguration(){
|
51e6872d
Mihail
add custom test f...
|
29
|
|
884c04ad
Mihail
fixed issues with...
|
30
31
32
|
$this->data = Yii::$app->multiparser->parse( $this->file_path, $this->options );
$this->assertNotEmpty( $this->data, 'Output array is empty' );
$this->assertNotCount( 76, $this->data, 'Output array don`t have 76 rows' );
|
ad2e91f7
Mihail
move multyparser ...
|
33
|
$this->data = CustomArrayHelper::createAssocArray( $this->data, ['ARTICLE','CROSS_ARTICLE','BRAND','CROSS_BRAND'] );
|
884c04ad
Mihail
fixed issues with...
|
34
35
36
37
|
$this->assertArrayHasKey( 'ARTICLE', $this->data[0], 'Output array don`t have key - ARTICLE' );
$this->assertArrayHasKey( 'CROSS_ARTICLE', $this->data[0], 'Output array don`t have key - CROSS_ARTICLE' );
$this->assertArrayHasKey( 'BRAND', $this->data[0], 'Output array don`t have key - BRAND' );
$this->assertArrayHasKey( 'CROSS_BRAND', $this->data[0], 'Output array don`t have key - CROSS_BRAND' );
|
ad2e91f7
Mihail
move multyparser ...
|
38
|
|
51e6872d
Mihail
add custom test f...
|
39
40
41
42
43
44
45
46
47
48
|
}
protected function _after()
{
}
}
|