Merge branch 'master' into offset-comment-and-tests

Conflicts:
	tests/methods/ParseTest.php
This commit is contained in:
Fonata
2018-03-17 12:42:18 +01:00
15 changed files with 841 additions and 336 deletions

View File

@@ -57,7 +57,7 @@ class DefaultValuesPropertiesTest extends TestCase {
}
public function test_sort_type_default() {
$this->assertNull($this->csv->sort_type);
$this->assertEquals('regular', $this->csv->sort_type);
}
public function test_delimiter_default() {

View File

@@ -3,6 +3,7 @@
namespace ParseCsv\tests\properties;
use ParseCsv\Csv;
use ParseCsv\enums\SortEnum;
use PHPUnit\Framework\TestCase;
class PublicPropertiesTest extends TestCase {
@@ -145,4 +146,26 @@ class PublicPropertiesTest extends TestCase {
$this->assertCount($counter, $this->properties);
}
public function testDefaultSortTypeIsRegular(){
$this->assertEquals(SortEnum::SORT_TYPE_REGULAR, $this->csv->sort_type);
}
public function testSetSortType(){
$this->csv->sort_type = 'numeric';
$this->assertEquals(SortEnum::SORT_TYPE_NUMERIC, $this->csv->sort_type);
$this->csv->sort_type = 'string';
$this->assertEquals(SortEnum::SORT_TYPE_STRING, $this->csv->sort_type);
}
public function testGetSorting(){
$this->csv->sort_type = 'numeric';
$sorting = SortEnum::getSorting($this->csv->sort_type);
$this->assertEquals(SORT_NUMERIC, $sorting);
$this->csv->sort_type = 'string';
$sorting = SortEnum::getSorting($this->csv->sort_type);
$this->assertEquals(SORT_STRING, $sorting);
}
}