-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[master] Add explicit PHPUnit asserts to unit tests flagged as 'risky' by PHPUnit6 #34871
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 |
---|---|---|
|
@@ -239,12 +239,20 @@ public function testMultipleGroups($input) { | |
if (\count($groups) === 2) { | ||
$this->assertContains('Starting scan for user 1 out of 10 (user1)', $output); | ||
$this->assertContains('Starting scan for user 1 out of 10 (user11)', $output); | ||
} | ||
if (\count($groups) === 3) { | ||
} elseif (\count($groups) === 3) { | ||
$this->assertContains('Starting scan for user 1 out of 10 (user1)', $output); | ||
$this->assertContains('Starting scan for user 1 out of 10 (user11)', $output); | ||
$this->assertContains('Starting scan for user 1 out of 10 (user21)', $output); | ||
$this->assertContains('Starting scan for user 10 out of 10 (user30)', $output); | ||
} elseif (\count($groups) === 4) { | ||
$this->assertContains('Starting scan for user 1 out of 10 (user1)', $output); | ||
$this->assertContains('Starting scan for user 1 out of 20 (user11)', $output); | ||
$this->assertContains('Starting scan for user 11 out of 20 (user21)', $output); | ||
$this->assertContains('Starting scan for user 10 out of 10 (user40)', $output); | ||
} else { | ||
$this->fail( | ||
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. Make sure that if someone adds test cases with different numbers of groups in the command, that the test will fail until they add appropriate asserts. |
||
"testMultipleGroups supports testing with 2,3, or 4 groups but the input has $groups groups" | ||
); | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,6 +97,10 @@ public function testEmittingCallWithAdditionalArgument($className, $eventName, $ | |
$this->assertInstanceOf(GenericEvent::class, $calledAfterEvent[1]); | ||
$this->assertArrayHasKey('item', $calledAfterEvent[1]); | ||
$this->assertEquals('testing', $calledAfterEvent[1]->getArgument('item')); | ||
} else { | ||
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. Previously no checks were happening for the test cases that had an empty |
||
$this->assertEquals($calledAfterEvent[0], "$className.after$eventName"); | ||
$this->assertArrayHasKey('item', $calledAfterEvent[1]); | ||
$this->assertEquals('testing', $calledAfterEvent[1]->getArgument('item')); | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -155,7 +155,13 @@ public function testSearchUsers() { | |
public function testAddDouble() { | ||
$group = $this->getGroupName(); | ||
|
||
$this->backend->createGroup($group); | ||
$this->backend->createGroup($group); | ||
$this->assertTrue( | ||
$this->backend->createGroup($group), | ||
"there was a problem creating $group" | ||
); | ||
$this->assertFalse( | ||
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. The first time calling |
||
$this->backend->createGroup($group), | ||
"there was a problem creating $group a second time" | ||
); | ||
} | ||
} |
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.
While adjusting
OcmMiddlewareTest
I saw that the PHPdoc return specified here was wrong.This method either returns nothing (
void
) or throws an exception.