options[ 'mode' ] = 'crosses'; $this->options[ 'crosses' ] = [ 'class' => 'common\components\parsers\CustomCsvParser', 'auto_detect_first_line' => true, 'min_column_quantity' => 4, 'keys' =>['ARTICLE', 'CROSS_ARTICLE', 'BRAND', 'CROSS_BRAND'], 'converter_conf' => [ 'class' => ' common\components\parsers\CustomConverter', 'configuration' => [ "brand" => ['BRAND', 'CROSS_BRAND'], "crosses" => [], ]] ]; $this->file_path = Yii::getAlias('@data_parser') . '\crosses\test1.csv'; } public function testReadCrosses(){ $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' ); $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' ); $this->assertEquals( $this->data[0]['BRAND'], strtoupper($this->data[0]['BRAND']),'BRAND not converted to upper case' ); } protected function _after() { } }