1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-01-17 21:38:14 +01:00
php-debugbar/tests/DebugBar/Tests/DataCollector/ConfigCollectorTest.php

57 lines
1.7 KiB
PHP
Raw Normal View History

2013-08-14 21:37:24 +10:00
<?php
namespace DebugBar\Tests\DataCollector;
use DebugBar\Tests\DebugBarTestCase;
use DebugBar\DebugBar;
use DebugBar\DataCollector\ConfigCollector;
class ConfigCollectorTest extends DebugBarTestCase
{
public function testCollect()
{
$c = new ConfigCollector(array('s' => 'bar', 'a' => array(), 'o' => new \stdClass()));
$data = $c->collect();
$this->assertArrayHasKey('s', $data);
$this->assertEquals('bar', $data['s']);
$this->assertArrayHasKey('a', $data);
$this->assertEquals("[]", $data['a']);
2013-08-14 21:37:24 +10:00
$this->assertArrayHasKey('o', $data);
}
public function testName()
{
$c = new ConfigCollector(array(), 'foo');
$this->assertEquals('foo', $c->getName());
$this->assertArrayHasKey('foo', $c->getWidgets());
}
public function testAssets()
{
$c = new ConfigCollector();
$this->assertEmpty($c->getAssets());
$c->useHtmlVarDumper();
$this->assertNotEmpty($c->getAssets());
}
public function testHtmlRendering()
{
$c = new ConfigCollector(array('k' => array('one', 'two')));
$this->assertFalse($c->isHtmlVarDumperUsed());
$data = $c->collect();
$this->assertEquals(array('k'), array_keys($data));
$this->assertContains('one', $data['k']);
$this->assertContains('two', $data['k']);
$this->assertNotContains('span', $data['k']);
$c->useHtmlVarDumper();
$data = $c->collect();
$this->assertEquals(array('k'), array_keys($data));
$this->assertContains('one', $data['k']);
$this->assertContains('two', $data['k']);
$this->assertContains('span', $data['k']);
}
2014-01-16 21:41:41 +00:00
}