public function testArrayInfoGetKey() { $info = new phArrayInfo('[name][first][]'); $this->assertEquals($info->getKeyInfo(0)->getKey(), 'name', 'Key at 0 returned correctly'); $this->assertEquals($info->getKeyInfo(1)->getKey(), 'first', 'Key at 1 returned correctly'); $this->assertTrue($info->getKeyInfo(2)->isAutoKey(), 'Key at 2 returned correctly'); }
/** * @expectedException phFormException */ public function testAlreadyRegisteredArrayKeys() { $testData = new phArrayFormDataItem('test'); $info = new phArrayInfo('[1]'); $data = new phFormDataItem('1'); $testData->registerArrayKey($info->getKeyInfo(0), $data); $testData->registerArrayKey($info->getKeyInfo(0), $data); // should throw exception as already registered }