Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
koriym committed Jun 4, 2018
1 parent e31f377 commit b7dbe7f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 51 deletions.
8 changes: 0 additions & 8 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,4 @@
<directory suffix="Test.php">tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src</directory>
</whitelist>
</filter>
<php>
<ini name="error_reporting" value="-1" />
</php>
</phpunit>
58 changes: 15 additions & 43 deletions tests/Test/Panda/PandaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,55 +4,27 @@ class PandaTest extends PHPUnit_Framework_TestCase
{
protected function setUp()
{
error_reporting(E_ALL & ~E_DEPRECATED);
require_once 'PEAR.php';
$config = array(Panda::CONFIG_DEBUG => false,
Panda::CONFIG_VALID_PATH => array('/'),
Panda::CONFIG_LOG_PATH => '/tmp',
Panda::CONFIG_ON_ERROR_FIRED => false,
Panda::CONFIG_ON_FATAL_ERROR => 'Panda/template/fatal.html',
Panda::CONFIG_ENABLE_FIREPHP => true,
Panda::CONFIG_FATAL_HTML => 'Panda/template/fatal.html',
Panda::CONFIG_HTTP_TPL => 'Panda/template/http.php',
Panda::CONFIG_CATCH_FATAL => false,
Panda::CONFIG_CATCH_STRICT => true,
Panda::CONFIG_PANDA_PATH => '/',
Panda::CONFIG_EDITOR => 0);
$config = [
Panda::CONFIG_DEBUG => false,
Panda::CONFIG_VALID_PATH => ['/'],
Panda::CONFIG_LOG_PATH => '/tmp',
Panda::CONFIG_ON_ERROR_FIRED => false,
Panda::CONFIG_ON_FATAL_ERROR => 'Panda/template/fatal.html',
Panda::CONFIG_ENABLE_FIREPHP => true,
Panda::CONFIG_FATAL_HTML => 'Panda/template/fatal.html',
Panda::CONFIG_HTTP_TPL => 'Panda/template/http.php',
Panda::CONFIG_CATCH_FATAL => false,
Panda::CONFIG_CATCH_STRICT => true,
Panda::CONFIG_PANDA_PATH => '/',
Panda::CONFIG_EDITOR => 0
];
Panda::init($config);
}

/**
* Tears down the fixture, for example, closes a network connection.
* This method is called after a test is executed.
*/
protected function tearDown()
{
}

/**
*/
public function testGetConfig()
{
$config = Panda::getConfig();
$this->assertTrue(isset($config[Panda::CONFIG_DEBUG]));
$this->assertFalse($config[Panda::CONFIG_DEBUG]);
}

public function testInit()
{
$config = Panda::getConfig();
$config[Panda::CONFIG_DEBUG] = true;
Panda::init($config);
$config = Panda::getConfig();
$this->assertTrue($config[Panda::CONFIG_DEBUG] === true);
}

public function testOnPearError()
{
if (version_compare(PHP_VERSION, '5.5', '>=')) {
$last_handler = set_exception_handler(null);
$this->assertSame('Panda', $last_handler[0]);
$this->assertSame('onException', $last_handler[1]);
}
}

}

0 comments on commit b7dbe7f

Please sign in to comment.