PHP code example of backendtea / failuretest

1. Go to this page and download the library: Download backendtea/failuretest 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/ */

    

backendtea / failuretest example snippets


 

use FailureTest\AllowFailure;

class AllowFailureTest extends \PHPUnit\Framework\TestCase
{
    use AllowFailure;

    /** 
     * @allowedFailure
     */
    public function test_it_handles_a_failure()
    {
        //This doesn't cause errors
        $this->assertTrue(false);
    }
    
    /** 
     * @allowedFailure
     */
    public function test_a_success_is_allowed()
    {
        //This doesn't cause errors
        $this->assertTrue(true);
    }
    
    /** 
     * @mustFail
     */
    public function test_it_checks_out()
    {
        //This doesn't cause errors
        $this->assertTrue(false);
    }
    
    /**
     * @mustFail
     */
    public function test_it_goes_wrong()
    {
        //This will give a failed test
        $this->assertTrue(true);
    }
}