mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 00:36:38 +00:00
Added .editorconfig to tell others about spaces and tabs
Also: - formated source code according to these rules; - added spaces after commas in test code See GitHub issue #101
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
class default_values_properties_Test extends PHPUnit\Framework\TestCase {
|
||||
|
||||
/**
|
||||
* CSV
|
||||
* The parseCSV object
|
||||
@@ -38,7 +39,7 @@ class default_values_properties_Test extends PHPUnit\Framework\TestCase {
|
||||
|
||||
public function test_fields_default() {
|
||||
$this->assertTrue(is_array($this->csv->fields));
|
||||
$this->assertCount(0,$this->csv->fields);
|
||||
$this->assertCount(0, $this->csv->fields);
|
||||
}
|
||||
|
||||
public function test_sort_by_default() {
|
||||
@@ -56,12 +57,12 @@ class default_values_properties_Test extends PHPUnit\Framework\TestCase {
|
||||
|
||||
public function test_delimiter_default() {
|
||||
$this->assertTrue(is_string($this->csv->delimiter));
|
||||
$this->assertEquals(',',$this->csv->delimiter);
|
||||
$this->assertEquals(',', $this->csv->delimiter);
|
||||
}
|
||||
|
||||
public function test_enclosure_default() {
|
||||
$this->assertTrue(is_string($this->csv->enclosure));
|
||||
$this->assertEquals('"',$this->csv->enclosure);
|
||||
$this->assertEquals('"', $this->csv->enclosure);
|
||||
}
|
||||
|
||||
public function test_enclose_all_default() {
|
||||
@@ -83,17 +84,17 @@ class default_values_properties_Test extends PHPUnit\Framework\TestCase {
|
||||
|
||||
public function test_auto_depth_default() {
|
||||
$this->assertTrue(is_numeric($this->csv->auto_depth));
|
||||
$this->assertEquals(15,$this->csv->auto_depth);
|
||||
$this->assertEquals(15, $this->csv->auto_depth);
|
||||
}
|
||||
|
||||
public function test_auto_non_chars_default() {
|
||||
$this->assertTrue(is_string($this->csv->auto_non_chars));
|
||||
$this->assertEquals("a-zA-Z0-9\n\r",$this->csv->auto_non_chars);
|
||||
$this->assertEquals("a-zA-Z0-9\n\r", $this->csv->auto_non_chars);
|
||||
}
|
||||
|
||||
public function test_auto_preferred_default() {
|
||||
$this->assertTrue(is_string($this->csv->auto_preferred));
|
||||
$this->assertEquals(",;\t.:|",$this->csv->auto_preferred);
|
||||
$this->assertEquals(",;\t.:|", $this->csv->auto_preferred);
|
||||
}
|
||||
|
||||
public function test_convert_encoding_default() {
|
||||
@@ -103,27 +104,27 @@ class default_values_properties_Test extends PHPUnit\Framework\TestCase {
|
||||
|
||||
public function test_input_encoding_default() {
|
||||
$this->assertTrue(is_string($this->csv->input_encoding));
|
||||
$this->assertEquals('ISO-8859-1',$this->csv->input_encoding);
|
||||
$this->assertEquals('ISO-8859-1', $this->csv->input_encoding);
|
||||
}
|
||||
|
||||
public function test_output_encoding_default() {
|
||||
$this->assertTrue(is_string($this->csv->output_encoding));
|
||||
$this->assertEquals('ISO-8859-1',$this->csv->output_encoding);
|
||||
$this->assertEquals('ISO-8859-1', $this->csv->output_encoding);
|
||||
}
|
||||
|
||||
public function test_linefeed_default() {
|
||||
$this->assertTrue(is_string($this->csv->linefeed));
|
||||
$this->assertEquals("\r",$this->csv->linefeed);
|
||||
$this->assertEquals("\r", $this->csv->linefeed);
|
||||
}
|
||||
|
||||
public function test_output_delimiter_default() {
|
||||
$this->assertTrue(is_string($this->csv->output_delimiter));
|
||||
$this->assertEquals(',',$this->csv->output_delimiter);
|
||||
$this->assertEquals(',', $this->csv->output_delimiter);
|
||||
}
|
||||
|
||||
public function test_output_filename_default() {
|
||||
$this->assertTrue(is_string($this->csv->output_filename));
|
||||
$this->assertEquals('data.csv',$this->csv->output_filename);
|
||||
$this->assertEquals('data.csv', $this->csv->output_filename);
|
||||
}
|
||||
|
||||
public function test_keep_file_data_default() {
|
||||
@@ -141,21 +142,21 @@ class default_values_properties_Test extends PHPUnit\Framework\TestCase {
|
||||
|
||||
public function test_error_default() {
|
||||
$this->assertTrue(is_numeric($this->csv->error));
|
||||
$this->assertEquals(0,$this->csv->error);
|
||||
$this->assertEquals(0, $this->csv->error);
|
||||
}
|
||||
|
||||
public function test_error_info_default() {
|
||||
$this->assertTrue(is_array($this->csv->error_info));
|
||||
$this->assertCount(0,$this->csv->error_info);
|
||||
$this->assertCount(0, $this->csv->error_info);
|
||||
}
|
||||
|
||||
public function test_titles_default() {
|
||||
$this->assertTrue(is_array($this->csv->titles));
|
||||
$this->assertCount(0,$this->csv->titles);
|
||||
$this->assertCount(0, $this->csv->titles);
|
||||
}
|
||||
|
||||
public function test_data_default() {
|
||||
$this->assertTrue(is_array($this->csv->data));
|
||||
$this->assertCount(0,$this->csv->data);
|
||||
$this->assertCount(0, $this->csv->data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
class worthless_properties_Test extends PHPUnit\Framework\TestCase {
|
||||
|
||||
/**
|
||||
* CSV
|
||||
* The parseCSV object
|
||||
@@ -64,7 +65,7 @@ class worthless_properties_Test extends PHPUnit\Framework\TestCase {
|
||||
* @access public
|
||||
*/
|
||||
public function test_propertiesCount() {
|
||||
$this->assertCount(27,$this->properties);
|
||||
$this->assertCount(27, $this->properties);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,17 +110,17 @@ class worthless_properties_Test extends PHPUnit\Framework\TestCase {
|
||||
);
|
||||
|
||||
//find our real properties
|
||||
$real_properties = array();
|
||||
for ($a=0; $a<count($this->properties); $a++) {
|
||||
$real_properties = [];
|
||||
for ($a = 0; $a < count($this->properties); $a++) {
|
||||
$real_properties[] = $this->properties[$a]->getName();
|
||||
}
|
||||
|
||||
//lets make sure our expected matches the number of real properties
|
||||
$this->assertCount(count($names),$this->properties);
|
||||
$this->assertCount(count($names), $this->properties);
|
||||
|
||||
//lets loop through our expected to make sure they exists
|
||||
for ($a=0; $a<count($names); $a++) {
|
||||
$this->assertTrue(in_array($names[$a],$real_properties));
|
||||
for ($a = 0; $a < count($names); $a++) {
|
||||
$this->assertTrue(in_array($names[$a], $real_properties));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,12 +134,12 @@ class worthless_properties_Test extends PHPUnit\Framework\TestCase {
|
||||
public function test_count_public_properties() {
|
||||
$counter = 0;
|
||||
|
||||
for ($a=0; $a<count($this->properties); $a++) {
|
||||
for ($a = 0; $a < count($this->properties); $a++) {
|
||||
if ($this->properties[$a]->isPublic() === true) {
|
||||
$counter++;
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertCount($counter,$this->properties);
|
||||
$this->assertCount($counter, $this->properties);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user