mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 00:36:38 +00:00
Added file parse_test.php to check for 'is_readable' warning
As documented in pull request #67
This commit is contained in:
41
tests/methods/parse_test.php
Normal file
41
tests/methods/parse_test.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
class parse_test extends PHPUnit_Framework_TestCase {
|
||||
|
||||
/**
|
||||
* CSV
|
||||
* The parseCSV object
|
||||
*
|
||||
* @access protected
|
||||
* @var parseCSV
|
||||
*/
|
||||
protected $csv;
|
||||
|
||||
/**
|
||||
* Setup
|
||||
* Setup our test environment objects
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
public function setUp() {
|
||||
$this->csv = new parseCSV();
|
||||
}
|
||||
|
||||
public function test_parse() {
|
||||
// can we trick 'is_readable' into whining? See #67.
|
||||
$this->parse_repetitive_string('c:/looks/like/a/path');
|
||||
$this->parse_repetitive_string('http://looks/like/an/url');
|
||||
}
|
||||
|
||||
private function parse_repetitive_string($content) {
|
||||
$this->csv->delimiter = ';';
|
||||
$this->csv->heading = FALSE;
|
||||
$success = $this->csv->parse(str_repeat($content . ';', 500));
|
||||
$this->assertEquals(TRUE, $success);
|
||||
|
||||
$row = array_pop($this->csv->data);
|
||||
$expected_data = array_fill(0, 500, $content);
|
||||
$expected_data [] = '';
|
||||
$this->assertEquals($expected_data, $row);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user