Your browser doesn't support the features required by impress.js, so you are presented with a simplified version of this presentation.
For the best experience please use the latest Chrome, Safari or Firefox browser.
Create a new composer project
{ "name": "fzerorubigd/tehlog-test", "description": "TDD demonstration", "authors": [ { "name": "fzerorubigd", "email": "[email protected]" } ], "require": { }, "require-dev": { "phpunit/phpunit": "~3.7" }, "config": { "bin-dir": "bin/" }, "autoload": { "psr-0": { "Cybits": "src/" } } }
then run the composer :
composer install --dev
<?xml version="1.0" encoding="UTF-8"?> <phpunit bootstrap="tests/bootstrap.php" colors="true"> <testsuites> <testsuite name="TDD example test suite"> <directory>tests/</directory> </testsuite> </testsuites> <filter> <whitelist> <directory suffix=".php">src/</directory> </whitelist> </filter> </phpunit>
<?php
class ExampleTest extends PHPUnit_Framework_TestCase
{
public function testMin()
{
$obj = new \Cybits\Example();
$this->assertEquals(10, $obj->min(10, 100));
}
public function testMax()
{
$obj = new \Cybits\Example();
$this->assertEquals(100, $obj->max(10, 100));
}
}
<?php
namespace Cybits;
class Example
{
public function min($a, $b)
{
return 10;
}
public function max($a, $b)
{
return 100;
}
}
f0rud@elbix:/home/f0rud/testSlides/php git:(master*) $ ./bin/phpunit
PHPUnit 3.7.28 by Sebastian Bergmann.
Configuration read from /home/f0rud/testSlides/php/phpunit.xml.dist
..
Time: 25 ms, Memory: 3.00Mb
OK (2 tests, 2 assertions)
<?php
class ExampleTest extends PHPUnit_Framework_TestCase
{
public function testMin()
{
$obj = new \Cybits\Example();
$this->assertEquals(10, $obj->min(10, 100));
$this->assertEquals(5, $obj->min(10, 5));
$this->assertEquals(1, $obj->min(1, 100));
}
public function testMax()
{
$obj = new \Cybits\Example();
$this->assertEquals(100, $obj->max(10, 100));
$this->assertEquals(70, $obj->max(11, 70));
$this->assertEquals(20, $obj->max(10, 20));
}
}
<?php
namespace Cybits;
class Example
{
public function min($a, $b)
{
return min($a, $b);
}
public function max($a, $b)
{
return max($a, $b);
}
}
Use a spacebar or arrow keys to navigate