1. Go to this page and download the library: Download fastknife/think-testing library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fastknife / think-testing example snippets
class SampleTest extends TestCase
{
public function testSomething()
{
$this->assertTrue(true, 'This should already work.');
}
/**
* @test
*/
public function something()
{
$this->assertTrue(true, 'This should already work.');
}
}
class MyTest extends TestCase{
/**
* @group specification
*/
public function testSomething(){
}
/**
* @group regresssion
* @group bug2204
*/
public function testSomethingElse(){
}
}
class MultipleDependenciesTest extends TestCase
{
public function testProducerFirst()
{
$this->assertTrue(true);
return 'first';
}
public function testProducerSecond()
{
$this->assertTrue(true);
return 'second';
}
/**
* @depends testProducerFirst
* @depends testProducerSecond
*/
public function testConsumer($a, $b)
{
$this->assertSame('first', $a);
$this->assertSame('second', $b);
}
}
class ExceptionTest extends TestCase
{
public function testException()
{
$this->expectException(\Exception::class);
throw new \Exception('test');
}
/**
* @throws \Exception
* @test
* @expectedException \Exception
*/
public function exceptionExpect()
{
throw new \Exception('test');
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.