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
[4.0] PHPUnit test fixes #14084
[4.0] PHPUnit test fixes #14084
Conversation
|
@@ -38,6 +38,6 @@ public function testConstructorSetsStreamTransport() | |||
{ | |||
$http = new JHttp; | |||
|
|||
$this->assertAttributeInstanceOf('JHttpTransportStream', 'transport', $http); | |||
$this->assertAttributeInstanceOf('JHttpTransportCurl', 'transport', $http); |
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.
This isn't quite right. The JMediawikiHttp
constructor is telling the JHttpFactory
it should only allow a JHttpTransportStream
object to be created, so why it's returning a JHttpTransportCurl
instance needs to be investigated.
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.
Probably because of this line:
https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/joomla/http/factory.php#L68
string no array
https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/joomla/mediawiki/http.php#L45
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.
Look at the line above in the factory, it's supposed to be setting the default value to an array so it should be supporting both strings and arrays in theory.
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.
@mbabker Look some lines below: https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/joomla/http/factory.php#L77
That can't work with a string (foreach)
if (is_string($availableAdapters))
{
$availableAdapters = array($availableAdapters);
}
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.
https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/joomla/http/factory.php#L67 should be setting $default
as an array before assigning it to $availableAdapters
so if that's not happening we've got another bug on our hands.
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.
You are right, overread that line. Going to debug it tomorrow morning..
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.
Actually when i look at this test again, the whole test makes no sense.. as we are creating a new JHttp instance and not a JMediawikiHttp.. And JHttp without parameters, which takes the first available adapter.
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.
This is why I shouldn't read pull requests before ☕️.
@mbabker Travis passes now, can you review? |
Summary of Changes
This should fix the unit tests in the 4.0 branch
Testing Instructions
Review & Travis
Expected result
Unit Tests should pass
Documentation Changes Required
None