Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
CsvTest.php
Go to the documentation of this file.
1 <?php
8 
10 
14 class CsvTest extends \PHPUnit\Framework\TestCase
15 {
21  protected $_model;
22 
23  protected function setUp()
24  {
25  $this->_model = new \Magento\Framework\File\Csv(new File());
26  }
27 
28  protected function tearDown()
29  {
30  unset($this->_model);
31  }
32 
33  public function testSetLineLength()
34  {
35  $expected = 4;
36  $this->_model->setLineLength($expected);
37  $lineLengthProperty = new \ReflectionProperty(\Magento\Framework\File\Csv::class, '_lineLength');
38  $lineLengthProperty->setAccessible(true);
39  $actual = $lineLengthProperty->getValue($this->_model);
40  $this->assertEquals($expected, $actual);
41  }
42 
43  public function testSetDelimiter()
44  {
45  $this->assertInstanceOf(\Magento\Framework\File\Csv::class, $this->_model->setDelimiter(','));
46  }
47 
48  public function testSetEnclosure()
49  {
50  $this->assertInstanceOf(\Magento\Framework\File\Csv::class, $this->_model->setEnclosure('"'));
51  }
52 
57  public function testGetDataFileNonExistent()
58  {
59  $file = 'FileNameThatShouldNotExist';
60  $this->_model->getData($file);
61  }
62 }