-
Notifications
You must be signed in to change notification settings - Fork 398
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
Improve assertion and ignore cached PHPUnit file #462
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
composer.lock | ||
/vendor | ||
/src/DebugBar/Resources/vendor | ||
/demo/bridge/*/vendor | ||
/src/DebugBar/Resources/vendor | ||
.phpunit.result.cache |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,16 +33,16 @@ public function testStartStopMeasure() | |
$this->assertEquals('bar', $m[0]['label']); | ||
$this->assertEquals('baz', $m[0]['collector']); | ||
$this->assertEquals(array('bar' => 'baz'), $m[0]['params']); | ||
$this->assertTrue($m[0]['start'] < $m[0]['end']); | ||
$this->assertLessThan($m[0]['end'], $m[0]['start']); | ||
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. Using the |
||
} | ||
|
||
public function testCollect() | ||
{ | ||
$this->c->addMeasure('foo', 0, 10); | ||
$this->c->addMeasure('bar', 10, 20); | ||
$data = $this->c->collect(); | ||
$this->assertTrue($data['end'] > $this->s); | ||
$this->assertTrue($data['duration'] > 0); | ||
$this->assertGreaterThan($this->s, $data['end']); | ||
$this->assertGreaterThan(0, $data['duration']); | ||
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. Using the |
||
$this->assertCount(2, $data['measures']); | ||
} | ||
|
||
|
@@ -54,7 +54,7 @@ public function testMeasure() | |
$m = $this->c->getMeasures(); | ||
$this->assertCount(1, $m); | ||
$this->assertEquals('bar', $m[0]['label']); | ||
$this->assertTrue($m[0]['start'] < $m[0]['end']); | ||
$this->assertLessThan($m[0]['end'], $m[0]['start']); | ||
$this->assertSame('returnedValue', $returned); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,8 +42,8 @@ public function testArrayAccess() | |
{ | ||
$this->debugbar->addCollector($c = new MockCollector()); | ||
$this->assertEquals($c, $this->debugbar['mock']); | ||
$this->assertTrue(isset($this->debugbar['mock'])); | ||
$this->assertFalse(isset($this->debugbar['foo'])); | ||
$this->assertArrayHasKey('mock', $this->debugbar); | ||
$this->assertArrayNotHasKey('foo', $this->debugbar); | ||
} | ||
|
||
public function testStorage() | ||
|
@@ -96,7 +96,7 @@ public function testStackedData() | |
$data = $this->debugbar->getStackedData(); | ||
$this->assertArrayNotHasKey($ns, $http->session); | ||
$this->assertArrayHasKey($id, $data); | ||
$this->assertEquals(1, count($data)); | ||
$this->assertCount(1, $data); | ||
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. Using the |
||
$this->assertArrayHasKey('mock', $data[$id]); | ||
$this->assertEquals($c->collect(), $data[$id]['mock']); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,13 +17,13 @@ public function setUp(): void | |
public function assertJsonIsArray($json) | ||
{ | ||
$data = json_decode($json); | ||
$this->assertTrue(is_array($data)); | ||
$this->assertIsArray($data); | ||
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. Using the |
||
} | ||
|
||
public function assertJsonIsObject($json) | ||
{ | ||
$data = json_decode($json); | ||
$this->assertTrue(is_object($data)); | ||
$this->assertIsObject($data); | ||
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. Using the |
||
} | ||
|
||
public function assertJsonArrayNotEmpty($json) | ||
|
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.
Using the
assertArrayHasKey
to assert the expected key is on the result array.