Exemplo n.º 1
0
 /**
  * Tests that fields have a machine name and description.
  *
  * @test
  *
  * @covers ::fields
  */
 public function fields()
 {
     $configuration = array('path' => $this->happyPath, 'identifiers' => array('id'), 'header_row_count' => 1);
     $fields = array('id' => 'identifier', 'first_name' => 'User first name');
     $expected = $fields + array('last_name' => 'last_name', 'email' => 'email', 'country' => 'country', 'ip_address' => 'ip_address');
     $csv = new CSV($configuration, $this->pluginId, $this->pluginDefinition, $this->plugin);
     $csv = new CSV($configuration + array('fields' => $fields), $this->pluginId, $this->pluginDefinition, $this->plugin);
     $this->assertArrayEquals($expected, $csv->fields());
     $column_names = array(0 => array('id' => 'identifier'), 2 => array('first_name' => 'User first name'));
     $csv = new CSV($configuration + array('fields' => $fields, 'column_names' => $column_names), $this->pluginId, $this->pluginDefinition, $this->plugin);
     $this->assertArrayEquals($fields, $csv->fields());
 }
Exemplo n.º 2
0
 /**
  * Tests that fields have a machine name and description.
  *
  * @test
  *
  * @covers ::fields
  */
 public function fields()
 {
     $configuration = ['path' => $this->happyPath, 'keys' => ['id'], 'header_row_count' => 1];
     $fields = ['id' => 'identifier', 'first_name' => 'User first name'];
     $expected = $fields + ['last_name' => 'last_name', 'email' => 'email', 'country' => 'country', 'ip_address' => 'ip_address'];
     $csv = new CSV($configuration, $this->pluginId, $this->pluginDefinition, $this->plugin);
     $csv = new CSV($configuration + ['fields' => $fields], $this->pluginId, $this->pluginDefinition, $this->plugin);
     $this->assertArrayEquals($expected, $csv->fields());
     $column_names = [0 => ['id' => 'identifier'], 2 => ['first_name' => 'User first name']];
     $csv = new CSV($configuration + ['fields' => $fields, 'column_names' => $column_names], $this->pluginId, $this->pluginDefinition, $this->plugin);
     $this->assertArrayEquals($fields, $csv->fields());
 }