-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unit Tests Fix for 3.7 #11413
Unit Tests Fix for 3.7 #11413
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -184,19 +184,22 @@ protected function getOptions() | |
{ | ||
$options = array(); | ||
|
||
foreach ($this->element->children() as $option) | ||
if (isset($this->element)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm seriously unconvinced by this :P This is bodging the production code to make the tests pass :P There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this is kinda weird, to say the least, but I could't figure out why this was failing and how to do it properly... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changing production code to make a test pass is a no go There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rdeutz I don't like this change as well but what could be the alternative here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well considering what There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I looked at the log on PHP 7 since that one doesn't completely fatal out. The tests for |
||
{ | ||
// Only add <option /> elements. | ||
if ($option->getName() != 'option') | ||
foreach ($this->element->children() as $option) | ||
{ | ||
continue; | ||
} | ||
// Only add <option /> elements. | ||
if ($option->getName() != 'option') | ||
{ | ||
continue; | ||
} | ||
|
||
// Create a new option object based on the <option /> element. | ||
$options[] = JHtml::_( | ||
'select.option', (string) $option['value'], | ||
JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)), 'value', 'text' | ||
); | ||
// Create a new option object based on the <option /> element. | ||
$options[] = JHtml::_( | ||
'select.option', (string) $option['value'], | ||
JText::alt(trim((string) $option), preg_replace('/[^a-zA-Z0-9_\-]/', '_', $this->fieldname)), 'value', 'text' | ||
); | ||
} | ||
} | ||
|
||
return $options; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In HTML5 you don't need required="required", but you can just use required. Any reason you included it here? (Yeah i prefer the XHTML style also and use it always)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Core by default is still spitting out XHTML compliant structure. There are only a couple of places where HTML5 is explicitly set and changes output and that's mainly with the JDocument renderers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I knew that this will come up so I made a print screen of the test failing because of that, enjoy:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because you are using
assertXmlStringEqualsXmlString
which means you need to have valid XML - and that's all key => value.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so use
assertEqualXMLStructure
?