Skip to content

Instantly share code, notes, and snippets.

@s4l1h
Created October 7, 2011 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s4l1h/1270397 to your computer and use it in GitHub Desktop.
Save s4l1h/1270397 to your computer and use it in GitHub Desktop.
PHPUnit Örneği
<?php
ini_set('include_path', ini_get('include_path') . PATH_SEPARATOR . '/usr/lib/php');
require_once 'PHPUnit/Autoload.php';
class Test extends PHPUnit_Framework_TestCase
{
public $dizi=array();
public $ad = NULL;
public function test1()
{
$this->assertEquals(0, sizeof($this->dizi));
}
public function test2()
{
$this->setAd('Test');
$this->assertTrue($this->checkAd());
}
private function setAd($ad)
{
$this->ad = $ad;
}
private function checkAd()
{
return $this->ad !== NULL ? TRUE : FALSE;
}
}
/*
Mac-mini$ phpunit Test.php
PHPUnit 3.5.15 by Sebastian Bergmann.
..
Time: 0 seconds, Memory: 2.75Mb
OK (2 tests, 2 assertions)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment