-
Notifications
You must be signed in to change notification settings - Fork 266
PHPLIB-294: Make test suite compatible with PHPUnit 6.4 #489
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 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 |
---|---|---|
|
@@ -27,6 +27,7 @@ public function testConstructorUpdateArgumentTypeCheck($update) | |
|
||
/** | ||
* @dataProvider provideUpdateDocuments | ||
* @doesNotPerformAssertions | ||
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. TIL Perhaps we can use this for the Bucket and WritableStream ReadableStream's |
||
*/ | ||
public function testConstructorUpdateArgument($update) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,7 @@ | |
} else { | ||
throw new Exception('Can\'t find autoload.php. Did you install dependencies with Composer?'); | ||
} | ||
|
||
if ( ! class_exists('PHPUnit\Framework\Error\Warning')) { | ||
class_alias('PHPUnit_Framework_Error_Warning', '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. This ensures that any reference to See the renaming I suggested at the bottom of #489 (comment) |
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.
It looks like there is no way to chain data providers so I thought this would be the most straightforward way to provide data to
testReadBytesCalledMultipleTimes()
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.
If you want to avoid duplicating the datasets from
provideFileIdAndExpectedBytes
, you could either call that data provider and run its return value througharray_filter
. Altternatively,testReadBytesCalledMultipleTimes
could just skip all datasets that don't apply withmarkTestSkipped
. Not sure if any of those sound better to you, just providing some ideas.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.
Were you by chance reading about
@depends
? That's the only form of test chaining I'm aware of, where the return value of one test can be used as input for a subsequent test case.Anywho, I think I mentioned using
array_filter()
earlier this week, which is exactly what @alcaeus is proposing here. SinceprovideFileIdAndExpectedBytes()
returns an array of argument arrays, and we just want to filter out any argument arrays where the length (i.e. second argument) is zero by using an anonymous function as our filter callback:Using
provideFileIdAndExpectedBytes()
as thearray_filter()
input, each of its 20 argument arrays will be run through our callback and only those where the callback returnstrue
will be kept. This allows us to re-use most of the existing data without duplicating it in the test sources.