summaryrefslogtreecommitdiffstats
path: root/test/FactoryTest.php
diff options
context:
space:
mode:
authorignace nyamagana butera <nyamsprod@gmail.com>2015-11-23 13:28:43 +0100
committerignace nyamagana butera <nyamsprod@gmail.com>2015-11-23 13:28:43 +0100
commit825481f581dccb97bf57f08cb93816a26eed3669 (patch)
treecd319df6af811389b599f6a126dd93e1491c9c93 /test/FactoryTest.php
parent991e3b26fef334c2a21befb00a40f4c7e8fabf8b (diff)
downloadcsv-825481f581dccb97bf57f08cb93816a26eed3669.zip
csv-825481f581dccb97bf57f08cb93816a26eed3669.tar.gz
csv-825481f581dccb97bf57f08cb93816a26eed3669.tar.bz2
Remove deprecated newline parameters from CreateFromString
Diffstat (limited to 'test/FactoryTest.php')
-rw-r--r--test/FactoryTest.php17
1 files changed, 13 insertions, 4 deletions
diff --git a/test/FactoryTest.php b/test/FactoryTest.php
index 377b1b9..f696176 100644
--- a/test/FactoryTest.php
+++ b/test/FactoryTest.php
@@ -2,6 +2,7 @@
namespace League\Csv\Test;
+use ArrayIterator;
use League\Csv\Reader;
use SplFileInfo;
use SplFileObject;
@@ -14,21 +15,21 @@ class FactoryTest extends AbstractTestCase
{
public function testCreateFromPathWithFilePath()
{
- $path = __DIR__.'/foo.csv';
+ $path = __DIR__.'/data/foo.csv';
$csv = Reader::createFromPath($path);
$this->assertSame($path, $csv->getIterator()->getRealPath());
}
public function testCreateFromPathWithSplFileInfo()
{
- $path = __DIR__.'/foo.csv';
+ $path = __DIR__.'/data/foo.csv';
$csv = Reader::createFromPath(new SplFileInfo($path));
$this->assertSame($path, $csv->getIterator()->getRealPath());
}
public function testCreateFromPathWithPHPWrapper()
{
- $path = __DIR__.'/foo.csv';
+ $path = __DIR__.'/data/foo.csv';
$csv = Reader::createFromPath('php://filter/read=string.toupper/resource='.$path);
$this->assertFalse($csv->getIterator()->getRealPath());
}
@@ -41,6 +42,14 @@ class FactoryTest extends AbstractTestCase
Reader::createFromPath(new SplTempFileObject());
}
+ /**
+ * @expectedException InvalidArgumentException
+ */
+ public function testCreateFromPathWithInvalidObject()
+ {
+ Reader::createFromPath(new ArrayIterator([]));
+ }
+
public function testCreateFromString()
{
$expected = 'john,doe,john.doe@example.com'.PHP_EOL
@@ -58,7 +67,7 @@ class FactoryTest extends AbstractTestCase
public function testCreateFromFileObjectWithSplFileObject()
{
- $path = __DIR__.'/foo.csv';
+ $path = __DIR__.'/data/foo.csv';
$obj = new SplFileObject($path);
$reader = Reader::createFromFileObject($obj);
$this->assertInstanceof('League\Csv\Reader', $reader);