Skip to content

Instantly share code, notes, and snippets.

@suin
Created December 28, 2011 13:09
Show Gist options
  • Save suin/1527890 to your computer and use it in GitHub Desktop.
Save suin/1527890 to your computer and use it in GitHub Desktop.
PHPUnitで定数のテストをするときは@runInSeparateProcessで別プロセスに ref: http://qiita.com/items/1476
<?php
class ConstantTest extends PHPUnit_Framework_TestCase
{
/**
* @runInSeparateProcess
*/
public function testConstant1()
{
define('THIS_IS_CONSTANT', 'foo');
$this->assertSame('foo', THIS_IS_CONSTANT);
}
/**
* @runInSeparateProcess
*/
public function testConstant2()
{
define('THIS_IS_CONSTANT', 'bar');
$this->assertSame('bar', THIS_IS_CONSTANT);
}
/**
* @runInSeparateProcess
*/
public function testConstant3()
{
define('THIS_IS_CONSTANT', 'baz');
$this->assertSame('baz', THIS_IS_CONSTANT);
}
}
PHPUnit 3.6.3 by Sebastian Bergmann.
...
Time: 0 seconds, Memory: 4.75Mb
OK (3 tests, 3 assertions)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment