Skip to content

Commit

Permalink
- apply changes after review
Browse files Browse the repository at this point in the history
  • Loading branch information
Athanasios Tsavlidis committed Dec 4, 2018
1 parent d3e4634 commit a610f19
Showing 1 changed file with 102 additions and 97 deletions.
199 changes: 102 additions & 97 deletions tests/IteratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,102 +16,6 @@
class IteratorTest extends PHPUnitTestCase
{
const FILE_PATH = 'input_files\iterator_test.xlsx';
const EXPECTED_ARRAY = array(
0 => array(
0 => 'text1',
1 => 'text2',
2 => 'text3',
3 => '',
4 => 'shared string',
5 => 'inline string'
),
1 => array(),
2 => array(
0 => '',
1 => '',
2 => '',
3 => 'text1',
4 => 'text1',
5 => 'text1'
),
3 => array(
0 => '',
1 => '',
2 => '',
3 => 'text2',
4 => 'text2',
5 => 'text2'
),
4 => array(
0 => '',
1 => '',
2 => '',
3 => 'text3',
4 => 'text3',
5 => 'text3'
),
5 => array(
0 => 'all borders',
1 => '',
2 => '',
3 => '',
4 => '',
5 => '',
6 => '',
7 => 'border-a1',
8 => 'border-b1',
9 => 'border-c1'
),
6 => array(
0 => '',
1 => '',
2 => '',
3 => '',
4 => '',
5 => '',
6 => '',
7 => 'border-a2',
8 => 'border-b2',
9 => 'border-c2'
),
7 => array(
0 => '',
1 => '',
2 => '',
3 => '',
4 => '',
5 => '',
6 => '',
7 => 'border-a3',
8 => 'border-b3',
9 => 'border-c3'
),
8 => array(
0 => '12345',
1 => '123.45',
2 => '123.45',
3 => '',
4 => '12468.45',
5 => '12468'
),
9 => array(),
10 => array(
0 => '10000.4',
1 => '10000.4',
2 => '10000.4',
3 => '10001',
4 => '10000.4',
5 => '10000.4'
),
11 => array(),
12 => array(
0 => 'a cell',
1 => 'a long cell',
2 => '',
3 => '',
4 => ''
)
);

/** @var XLSXReader */
private $reader;
Expand Down Expand Up @@ -185,6 +89,107 @@ public function testFunctionValid()
$read_file[] = $this->reader->current();
$this->reader->next();
}
self::assertEquals(self::EXPECTED_ARRAY, $read_file, 'File has not be read correctly');
self::assertFalse($this->reader->valid(), 'File reading has finished and it is still valid');
self::assertEquals($this->getExpectedArray(), $read_file, 'File has not been read correctly');
}

private function getExpectedArray()
{
return array(
array(
'text1',
'text2',
'text3',
'',
'shared string',
'inline string'
),
array(),
array(
'',
'',
'',
'text1',
'text1',
'text1'
),
array(
'',
'',
'',
'text2',
'text2',
'text2'
),
array(
'',
'',
'',
'text3',
'text3',
'text3'
),
array(
'all borders',
'',
'',
'',
'',
'',
'',
'border-a1',
'border-b1',
'border-c1'
),
array(
'',
'',
'',
'',
'',
'',
'',
'border-a2',
'border-b2',
'border-c2'
),
array(
'',
'',
'',
'',
'',
'',
'',
'border-a3',
'border-b3',
'border-c3'
),
array(
'12345',
'123.45',
'123.45',
'',
'12468.45',
'12468'
),
array(),
array(
'10000.4',
'10000.4',
'10000.4',
'10001',
'10000.4',
'10000.4'
),
array(),
array(
'a cell',
'a long cell',
'',
'',
''
)
);
}
}

0 comments on commit a610f19

Please sign in to comment.