/** * @covers ZfcUser\Form\Login::__construct * @dataProvider providerTestConstruct */ public function testConstruct($authIdentityFields = array()) { $options = $this->getMock('ZfcUser\\Options\\AuthenticationOptionsInterface'); $options->expects($this->once())->method('getAuthIdentityFields')->will($this->returnValue($authIdentityFields)); $form = new Form(null, $options); $elements = $form->getElements(); $this->assertArrayHasKey('identity', $elements); $this->assertArrayHasKey('credential', $elements); $expectedLabel = ""; if (count($authIdentityFields) > 0) { foreach ($authIdentityFields as $field) { $expectedLabel .= $expectedLabel == "" ? '' : ' or '; $expectedLabel .= ucfirst($field); $this->assertContains(ucfirst($field), $elements['identity']->getLabel()); } } $this->assertEquals($expectedLabel, $elements['identity']->getLabel()); }