function testExplodeValuesMultiple()
 {
     $valueExploder = new VF_Import_ValueExploder();
     $this->importDefinitions();
     $result = $valueExploder->explode(array('make' => 'honda', 'model' => '{{all}}', 'year' => '{{all}}'));
     $this->assertEquals(3, count($result), 'value exploder should explode multiple tokens');
     $this->assertEquals(array('make' => 'honda', 'model' => 'civic', 'year' => 2000), $result[0]);
     $this->assertEquals(array('make' => 'honda', 'model' => 'civic', 'year' => 2001), $result[1]);
     $this->assertEquals(array('make' => 'honda', 'model' => 'accord', 'year' => 2000), $result[2]);
 }
Пример #2
0
 function explodeWildcardCombinations($combinations)
 {
     $result = array();
     foreach ($combinations as $key => $combination) {
         // blow out {{all}} tokens
         $valueExploder = new VF_Import_ValueExploder();
         $result = array_merge($result, $valueExploder->explode($combination));
     }
     return $result;
 }
 function testExplodeValues()
 {
     
     $valueExploder = new VF_Import_ValueExploder;
     $this->importDefinitions();
     
     $result = $valueExploder->explode( array('make'=>'honda','model'=>'civic','trim'=>'{{all}}','engine'=>'{{all}}','year'=>2000) );
     
     $this->assertEquals( 4, count($result), 'value exploder should explode multiple tokens' );
     $this->assertEquals( array('make'=>'honda','model'=>'civic','trim'=>'ex','engine'=>'a','year'=>2000), $result[0] );
     $this->assertEquals( array('make'=>'honda','model'=>'civic','trim'=>'ex','engine'=>'b','year'=>2000), $result[1] );
     $this->assertEquals( array('make'=>'honda','model'=>'civic','trim'=>'lx','engine'=>'a','year'=>2000), $result[2] );
     $this->assertEquals( array('make'=>'honda','model'=>'civic','trim'=>'lx','engine'=>'b','year'=>2000), $result[3] );
 }