added test for sort enums (todo: handle exception on test)

This commit is contained in:
Susann Sgorzaly
2018-02-22 21:15:00 +01:00
parent a74736d4da
commit 7a3120dd28
2 changed files with 19 additions and 0 deletions

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,20 @@ 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 = SortEnum::SORT_TYPE_NUMERIC;
$this->assertEquals(SortEnum::SORT_TYPE_NUMERIC, $this->csv->sort_type);
$this->csv->sort_type = SortEnum::SORT_TYPE_STRING;
$this->assertEquals(SortEnum::SORT_TYPE_STRING, $this->csv->sort_type);
$this->csv->sort_type = SortEnum::SORT_TYPE_UNKNOWN;
// todo: how to handle this exception?
$this->expectException(InvalidArgumentException::class);
}
}