Skip to content

Instantly share code, notes, and snippets.

@monsat
Created May 29, 2012 22:45
Show Gist options
  • Save monsat/2831229 to your computer and use it in GitHub Desktop.
Save monsat/2831229 to your computer and use it in GitHub Desktop.
PHPUnit Class
<?php
# tests/SampleTest.php
require __DIR__ . '/../lib/Sample.php';
class SampleTest extends PHPUnit_Framework_TestCase {
public function testAnyMethod() {
$this->object = new Sample();
$this->assertEquals('正しい値', $this->Sample->anyMethod(), 'テストが失敗されたときに表示されるコメント');
}
}
<?php
# tests/SampleTest.php
require __DIR__ . '/../lib/Sample.php';
class SampleTest extends PHPUnit_Framework_TestCase {
public function setUp() {
$this->object = new Sample();
}
public function tearDown() {
unset($this->object);
}
public function testAnyMethod() {
$this->assertEquals('正しい値', $this->Sample->anyMethod(), 'テストが失敗されたときに表示されるコメント');
}
}
<?php
# tests/SampleTest.php
require __DIR__ . '/../lib/Sample.php';
class SampleTest extends PHPUnit_Framework_TestCase {
public function setUp() {
$this->object = new Sample();
}
public function tearDown() {
unset($this->object);
}
/**
* @group regression
* @group bug2204
*/
public function testAnyMethod() {
$this->assertEquals('正しい値', $this->Sample->anyMethod(), 'テストが失敗されたときに表示されるコメント');
}
}
// $ phpunit --group bug2204
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment