testSimpleFunctionality()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.7666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace itertools;
4
5
use PHPUnit_Framework_TestCase;
6
7
8
class FixedLengthFormattedStringIteratorTest extends PHPUnit_Framework_TestCase
9
{
10
	/** @test */
11
	public function testSimpleFunctionality()
12
	{
13
		$input = array(
14
			'jos            , 1  , m',
15
			'piet           , 120, m',
16
			'tutu le wallon , 50 , f',
17
		);
18
		$template = 
19
			'<name         >  age, g';
20
		$names = array('g' => 'gender');
21
		$result = iterator_to_array(FixedLengthFormattedStringIterator::newFromTemplate($input, $template, $names, array('trim' => ' ')));
22
		$this->assertEquals('jos', $result[0]['name']);
23
		$this->assertEquals('120', $result[1]['age']);
24
		$this->assertEquals('m', $result[1]['gender']);
25
	}
26
27
	/** @test */
28
	public function testComposingIterator()
29
	{
30
	}
31
32
	/**
33
	 * @test
34
	 * @expectedException InvalidArgumentException
35
	 */
36
	public function testFileCsvIteratorWithInvalidArguments()
37
	{
38
		new FixedLengthFormattedStringIterator(array(), array(), array('invalid' => 'option'));
39
	}
40
}
41
42