-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Further refactorings to PHPUnit namespaces #21688
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
Changes from 2 commits
602638d
87ed7ce
54c28b4
d784a2f
f0263d3
58cb402
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 |
---|---|---|
|
@@ -24,7 +24,11 @@ public static function handle($errorNumber, $message, $file, $line, $context) | |
return true; | ||
} | ||
|
||
return \PHPUnit_Util_ErrorHandler::handleError($errorNumber, $message, $file, $line); | ||
if (class_exists('\PHPUnit_Util_ErrorHandler')) { | ||
return \PHPUnit_Util_ErrorHandler::handleError($errorNumber, $message, $file, $line); | ||
} | ||
|
||
return \PHPUnit\Util\ErrorHandler::handleError($errorNumber, $message, $file, $line); | ||
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. Should probably be using a use statement (same goes for the rest) 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. You mean just for the namespaced versions? I was unsure about it and therefore kept it as is. I can easily update that if wanted. 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 personal have a preference to keep the FQCN inline with no use - makes things more readable (especially true on the other cases below). |
||
} | ||
|
||
public static function handleBC($errorNumber, $message, $file, $line, $context) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -306,10 +306,15 @@ public function formatTypeDoubleWithCurrencyStyleProvider() | |
|
||
/** | ||
* @dataProvider formatTypeCurrencyProvider | ||
* @expectedException \PHPUnit_Framework_Error_Warning | ||
*/ | ||
public function testFormatTypeCurrency($formatter, $value) | ||
{ | ||
if (class_exists('\PHPUnit_Framework_Error_Warning')) { | ||
$this->setExpectedException('\PHPUnit_Framework_Error_Warning'); | ||
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. leading backslash |
||
} else { | ||
$this->setExpectedException('\PHPUnit\Framework\Error\Warning'); | ||
} | ||
|
||
$formatter->format($value, NumberFormatter::TYPE_CURRENCY); | ||
} | ||
|
||
|
@@ -641,11 +646,13 @@ public function parseProvider() | |
); | ||
} | ||
|
||
/** | ||
* @expectedException \PHPUnit_Framework_Error_Warning | ||
*/ | ||
public function testParseTypeDefault() | ||
{ | ||
if (class_exists('\PHPUnit_Framework_Error_Warning')) { | ||
$this->setExpectedException('\PHPUnit_Framework_Error_Warning'); | ||
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. you said this method is deprecated? should be do a method_exists check and use the new way when possible? |
||
} else { | ||
$this->setExpectedException('\PHPUnit\Framework\Error\Warning'); | ||
} | ||
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); | ||
$formatter->parse('1', NumberFormatter::TYPE_DEFAULT); | ||
} | ||
|
@@ -782,11 +789,13 @@ public function parseTypeDoubleProvider() | |
); | ||
} | ||
|
||
/** | ||
* @expectedException \PHPUnit_Framework_Error_Warning | ||
*/ | ||
public function testParseTypeCurrency() | ||
{ | ||
if (class_exists('\PHPUnit_Framework_Error_Warning')) { | ||
$this->setExpectedException('\PHPUnit_Framework_Error_Warning'); | ||
} else { | ||
$this->setExpectedException('\PHPUnit\Framework\Error\Warning'); | ||
} | ||
$formatter = $this->getNumberFormatter('en', NumberFormatter::DECIMAL); | ||
$formatter->parse('1', NumberFormatter::TYPE_CURRENCY); | ||
} | ||
|
Uh oh!
There was an error while loading. Please reload this page.
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.
the leading backslash should be removed in all strings (this one and below)