public function testGenerateInput() { FormGenerator::start('text'); FormGenerator::addName('AnyInputName'); $itemsArray = ['AnyElement' => 'AnyValue']; FormGenerator::addItem($itemsArray); FormGenerator::required(); $this->assertEquals('<input type="text" name="AnyInputName" required AnyElement="AnyValue">', FormGenerator::render()); }
/** * * @param array $customItem * @return string */ public function inputSearch(array $customItem = null) : string { FormGenerator::start('text'); FormGenerator::addName('search'); FormGenerator::addItem(['class' => 'form-control']); FormGenerator::addItem($customItem); FormGenerator::required(); return FormGenerator::render(); }
/** * * @param string $type * @param string $name * @param array $item * @param array $customItem * @return string */ private function generateInput(string $type, string $name, array $item, array $customItem = null) : string { FormGenerator::start($type); FormGenerator::addName($name); FormGenerator::addItem($item); if ($type != 'password') { $this->addResponseInputValue($name); } $this->addAccountValue($name); FormGenerator::addItem($customItem); FormGenerator::required(); return FormGenerator::render(); }