ZipIteratorTest::testZipIterator()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.7998
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace itertools;
4
5
use ArrayIterator;
6
use PHPUnit_Framework_TestCase;
7
8
9
class ZipIteratorTest extends PHPUnit_Framework_TestCase
10
{
11
	/** @test */
12
	public function testZipIterator()
13
	{
14
		$column1 = new ArrayIterator(array(1, 2, 3, 4));
15
		$column2 = new ArrayIterator(array('a', 'b', 'c'));
16
		$column3 = new ArrayIterator(array('A', 'B', 'C'));
17
18
		$zipIterator = ZipIterator::newFromArguments($column1, $column2, $column3);
19
20
		$zippedValues = iterator_to_array($zipIterator);
21
		$this->assertEquals(array(1, 'a', 'A'), $zippedValues[0]);
22
		$this->assertEquals(array(2, 'b', 'B'), $zippedValues[1]);
23
		$this->assertEquals(array(3, 'c', 'C'), $zippedValues[2]);
24
		$this->assertEquals(3, count($zippedValues));
25
	}
26
27
	/**
28
	 * @test
29
	 * @expectedException \InvalidArgumentException
30
	 */
31
	public function testThrowsExceptionForEmptyInput()
32
	{
33
		new ZipIterator(array());
34
	}
35
}
36
37
 
38