/**
* @test
* @dataProvider provider
*/
public function testConstructor($aListData, $propertyName, $dataClassName = null, $opt = array())
{
$list = new ListDataType($aListData, $propertyName, $dataClassName);
$this->assertEquals($opt, $list->getQueryArray(), 'Unexpected options array');
$this->assertEquals(count($opt), (is_array($propertyName) ? count($propertyName) : 1) * count($list), 'Different number of arguments');
$this->assertInstanceOf('Iterator', $list, 'List does not implement Iterator interface.');
$this->assertInstanceOf('Countable', $list, 'List does not implement Countable interface.');
if (!is_array($propertyName)) {
$keys = array_keys($opt);
foreach ($list->getQueryArray() as $key => $value) {
$this->assertContains($key, $keys, 'Missing key');
$this->assertContains($value, $opt, 'Missing value');
}
$this->assertEquals(array_values($opt), $list->getComputed(), 'Unexpected out of getComputed() method.');
} else {
if ($dataClassName != null) {
foreach ($list as $value) {
$this->assertInstanceOf($dataClassName, $value);
}
}
}
unset($list);
}