set(PasswordField::class, 'autocomplete', $bool); $field = new PasswordField('test'); $attrs = $field->getAttributes(); $this->assertArrayHasKey('autocomplete', $attrs); $this->assertEquals($bool ? 'on' : 'off', $attrs['autocomplete']); } /** * @dataProvider boolDataProvider * @param bool $bool */ public function testValuePostback($bool) { $field = (new PasswordField('test', 'test', 'password')) ->setAllowValuePostback($bool); $attrs = $field->getAttributes(); $this->assertArrayHasKey('value', $attrs); $this->assertEquals($bool ? 'password' : '', $attrs['value']); } }