mirror of
https://github.com/parsecsv/parsecsv-for-php.git
synced 2026-02-19 08:36:39 +00:00
- https://svn.apache.org/repos/asf/shindig/attic/php/docs/style-guide.html: "Acryonyms are treated as normal words." - https://softwareengineering.stackexchange.com/a/149321/80632 Overview of class naming conventions of PHP frameworks - https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md No .lib allowed: "The class name corresponds to a file name ending in .php" See issue #50
59 lines
1.7 KiB
PHP
59 lines
1.7 KiB
PHP
<?php
|
|
|
|
class ConstructTest extends PHPUnit\Framework\TestCase {
|
|
|
|
/**
|
|
* CSV
|
|
* The parseCSV object
|
|
*
|
|
* @access protected
|
|
* @var [parseCSV]
|
|
*/
|
|
protected $csv = null;
|
|
|
|
/**
|
|
* Tear down
|
|
* Tear down our test environment objects
|
|
*
|
|
* @access public
|
|
*/
|
|
public function tearDown() {
|
|
$this->csv = null;
|
|
}
|
|
|
|
public function test_offset_param() {
|
|
$offset = 10;
|
|
$this->csv = new ParseCsvForPhp(null, $offset);
|
|
$this->assertTrue(is_numeric($this->csv->offset));
|
|
$this->assertEquals($offset, $this->csv->offset);
|
|
}
|
|
|
|
public function test_limit_param() {
|
|
$limit = 10;
|
|
$this->csv = new ParseCsvForPhp(null, null, $limit);
|
|
$this->assertTrue(is_numeric($this->csv->limit));
|
|
$this->assertEquals($limit, $this->csv->limit);
|
|
}
|
|
|
|
public function test_conditions_param() {
|
|
$conditions = 'some column NOT value';
|
|
$this->csv = new ParseCsvForPhp(null, null, null, $conditions);
|
|
$this->assertTrue(is_string($this->csv->conditions));
|
|
$this->assertEquals($conditions, $this->csv->conditions);
|
|
}
|
|
|
|
public function test_keep_file_data_param() {
|
|
$keep = true;
|
|
$this->csv = new ParseCsvForPhp(null, null, null, null, $keep);
|
|
$this->assertTrue(is_bool($this->csv->keep_file_data));
|
|
$this->assertEquals($keep, $this->csv->keep_file_data);
|
|
}
|
|
|
|
public function test_input_param() {
|
|
$csv = "col1,col2,col3\r\nval1,val2,val3\r\nval1A,val2A,val3A\r\n";
|
|
$this->csv = new ParseCsvForPhp($csv, null, null, null, true);
|
|
$this->assertTrue(is_string($this->csv->file_data));
|
|
$this->assertEquals($csv, $this->csv->file_data);
|
|
}
|
|
}
|