public function AbstractProfilerStorageTest::testChildren in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/http-kernel/Tests/Profiler/AbstractProfilerStorageTest.php \Symfony\Component\HttpKernel\Tests\Profiler\AbstractProfilerStorageTest::testChildren()
File
- vendor/
symfony/ http-kernel/ Tests/ Profiler/ AbstractProfilerStorageTest.php, line 30
Class
Namespace
Symfony\Component\HttpKernel\Tests\ProfilerCode
public function testChildren() {
$parentProfile = new Profile('token_parent');
$parentProfile
->setIp('127.0.0.1');
$parentProfile
->setUrl('http://foo.bar/parent');
$childProfile = new Profile('token_child');
$childProfile
->setIp('127.0.0.1');
$childProfile
->setUrl('http://foo.bar/child');
$parentProfile
->addChild($childProfile);
$this
->getStorage()
->write($parentProfile);
$this
->getStorage()
->write($childProfile);
// Load them from storage
$parentProfile = $this
->getStorage()
->read('token_parent');
$childProfile = $this
->getStorage()
->read('token_child');
// Check child has link to parent
$this
->assertNotNull($childProfile
->getParent());
$this
->assertEquals($parentProfile
->getToken(), $childProfile
->getParentToken());
// Check parent has child
$children = $parentProfile
->getChildren();
$this
->assertCount(1, $children);
$this
->assertEquals($childProfile
->getToken(), $children[0]
->getToken());
}