mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
added test for sort enums (todo: handle exception on test)
This commit is contained in:
@@ -3,6 +3,8 @@ namespace ParseCsv\enums;
|
|||||||
|
|
||||||
|
|
||||||
class SortEnum extends AbstractEnum {
|
class SortEnum extends AbstractEnum {
|
||||||
|
const __DEFAULT = self::SORT_TYPE_REGULAR;
|
||||||
|
|
||||||
const SORT_TYPE_REGULAR = SORT_REGULAR;
|
const SORT_TYPE_REGULAR = SORT_REGULAR;
|
||||||
|
|
||||||
const SORT_TYPE_NUMERIC = SORT_NUMERIC;
|
const SORT_TYPE_NUMERIC = SORT_NUMERIC;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace ParseCsv\tests\properties;
|
namespace ParseCsv\tests\properties;
|
||||||
|
|
||||||
use ParseCsv\Csv;
|
use ParseCsv\Csv;
|
||||||
|
use ParseCsv\enums\SortEnum;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class PublicPropertiesTest extends TestCase {
|
class PublicPropertiesTest extends TestCase {
|
||||||
@@ -145,4 +146,20 @@ class PublicPropertiesTest extends TestCase {
|
|||||||
|
|
||||||
$this->assertCount($counter, $this->properties);
|
$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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user