diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/CsvTest.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/CsvTest.php b/test/CsvTest.php index 7a17eca..4477105 100644 --- a/test/CsvTest.php +++ b/test/CsvTest.php @@ -34,6 +34,11 @@ class CsvTest extends PHPUnit_Framework_TestCase $this->csv = new Reader($csv); } + public function tearDown() + { + $this->csv = null; + } + public function testConstructorWithFilePath() { $path = __DIR__.'/foo.csv'; @@ -74,6 +79,22 @@ class CsvTest extends PHPUnit_Framework_TestCase new Reader(['/usr/bin/foo.csv']); } + public function testCreateFromPath() + { + $path = __DIR__.'/foo.csv'; + + $csv = Reader::createFromPath(new SplFileInfo($path)); + $this->assertSame($path, $csv->getIterator()->getRealPath()); + } + + /** + * @expectedException InvalidArgumentException + */ + public function testFailedCreateFromPath() + { + Reader::createFromPath(new SplTempFileObject); + } + public function testCreateFromString() { $expected = "john,doe,john.doe@example.com".PHP_EOL |