mirror of
https://github.com/maximebf/php-debugbar.git
synced 2025-01-16 21:08:34 +01:00
Improve assertion and ignore cached PHPUnit file (#462)
This commit is contained in:
parent
e903b29e17
commit
6706ad4d2d
@ -19,7 +19,7 @@ class AggregatedCollectorTest extends DebugBarTestCase
|
||||
$this->c->addCollector($c = new MockCollector());
|
||||
$this->assertContains($c, $this->c->getCollectors());
|
||||
$this->assertEquals($c, $this->c['mock']);
|
||||
$this->assertTrue(isset($this->c['mock']));
|
||||
$this->assertArrayHasKey('mock', $this->c);
|
||||
}
|
||||
|
||||
public function testCollect()
|
||||
|
@ -37,7 +37,7 @@ class TimeDataCollectorTest extends DebugBarTestCase
|
||||
$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']);
|
||||
}
|
||||
|
||||
public function testCollect()
|
||||
@ -45,8 +45,8 @@ class TimeDataCollectorTest extends DebugBarTestCase
|
||||
$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']);
|
||||
$this->assertCount(2, $data['measures']);
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ class TimeDataCollectorTest extends DebugBarTestCase
|
||||
$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);
|
||||
}
|
||||
}
|
||||
|
@ -42,8 +42,8 @@ class DebugBarTest extends DebugBarTestCase
|
||||
{
|
||||
$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 @@ class DebugBarTest extends DebugBarTestCase
|
||||
$data = $this->debugbar->getStackedData();
|
||||
$this->assertArrayNotHasKey($ns, $http->session);
|
||||
$this->assertArrayHasKey($id, $data);
|
||||
$this->assertEquals(1, count($data));
|
||||
$this->assertCount(1, $data);
|
||||
$this->assertArrayHasKey('mock', $data[$id]);
|
||||
$this->assertEquals($c->collect(), $data[$id]['mock']);
|
||||
}
|
||||
|
@ -19,13 +19,13 @@ abstract class DebugBarTestCase extends TestCase
|
||||
public function assertJsonIsArray($json)
|
||||
{
|
||||
$data = json_decode($json);
|
||||
$this->assertTrue(is_array($data));
|
||||
$this->assertIsArray($data);
|
||||
}
|
||||
|
||||
public function assertJsonIsObject($json)
|
||||
{
|
||||
$data = json_decode($json);
|
||||
$this->assertTrue(is_object($data));
|
||||
$this->assertIsObject($data);
|
||||
}
|
||||
|
||||
public function assertJsonArrayNotEmpty($json)
|
||||
|
Loading…
x
Reference in New Issue
Block a user