-
-
Notifications
You must be signed in to change notification settings - Fork 224
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
24ac78d
commit e9b5b46
Showing
25 changed files
with
186 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
namespace Symfony\Component\Panther\DomCrawler\Field; | ||
|
||
use Symfony\Component\DomCrawler\Field\FileFormField as BaseFileFormField; | ||
use Symfony\Component\Panther\Exception\LogicException; | ||
|
||
/** | ||
* @author Robert Freigang <[email protected]> | ||
|
@@ -61,18 +62,18 @@ public function setFilePath(string $path): void | |
/** | ||
* Initializes the form field. | ||
* | ||
* @throws \LogicException When node type is incorrect | ||
* @throws LogicException When node type is incorrect | ||
*/ | ||
protected function initialize(): void | ||
{ | ||
$tagName = $this->element->getTagName(); | ||
if ('input' !== $tagName) { | ||
throw new \LogicException(\sprintf('A FileFormField can only be created from an input tag (%s given).', $tagName)); | ||
throw new LogicException(\sprintf('A FileFormField can only be created from an input tag (%s given).', $tagName)); | ||
} | ||
|
||
$type = strtolower($this->element->getAttribute('type')); | ||
if ('file' !== $type) { | ||
throw new \LogicException(\sprintf('A FileFormField can only be created from an input tag with a type of file (given type is %s).', $type)); | ||
throw new LogicException(\sprintf('A FileFormField can only be created from an input tag with a type of file (given type is %s).', $type)); | ||
} | ||
|
||
$value = $this->element->getAttribute('value'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
namespace Symfony\Component\Panther\DomCrawler\Field; | ||
|
||
use Symfony\Component\DomCrawler\Field\InputFormField as BaseInputFormField; | ||
use Symfony\Component\Panther\Exception\LogicException; | ||
|
||
/** | ||
* @author Kévin Dunglas <[email protected]> | ||
|
@@ -42,22 +43,22 @@ public function setValue($value): void | |
/** | ||
* Initializes the form field. | ||
* | ||
* @throws \LogicException When node type is incorrect | ||
* @throws LogicException When node type is incorrect | ||
*/ | ||
protected function initialize(): void | ||
{ | ||
$tagName = $this->element->getTagName(); | ||
if ('input' !== $tagName && 'button' !== $tagName) { | ||
throw new \LogicException(\sprintf('An InputFormField can only be created from an input or button tag (%s given).', $tagName)); | ||
throw new LogicException(\sprintf('An InputFormField can only be created from an input or button tag (%s given).', $tagName)); | ||
} | ||
|
||
$type = strtolower((string) $this->element->getAttribute('type')); | ||
if ('checkbox' === $type) { | ||
throw new \LogicException('Checkboxes should be instances of ChoiceFormField.'); | ||
throw new LogicException('Checkboxes should be instances of ChoiceFormField.'); | ||
} | ||
|
||
if ('file' === $type) { | ||
throw new \LogicException('File inputs should be instances of FileFormField.'); | ||
throw new LogicException('File inputs should be instances of FileFormField.'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
namespace Symfony\Component\Panther\DomCrawler\Field; | ||
|
||
use Symfony\Component\DomCrawler\Field\TextareaFormField as BaseTextareaFormField; | ||
use Symfony\Component\Panther\Exception\LogicException; | ||
|
||
/** | ||
* @author Kévin Dunglas <[email protected]> | ||
|
@@ -30,13 +31,13 @@ public function setValue(?string $value): void | |
/** | ||
* Initializes the form field. | ||
* | ||
* @throws \LogicException When node type is incorrect | ||
* @throws LogicException When node type is incorrect | ||
*/ | ||
protected function initialize(): void | ||
{ | ||
$tagName = $this->element->getTagName(); | ||
if ('textarea' !== $tagName) { | ||
throw new \LogicException(\sprintf('A TextareaFormField can only be created from a textarea tag (%s given).', $tagName)); | ||
throw new LogicException(\sprintf('A TextareaFormField can only be created from a textarea tag (%s given).', $tagName)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.