PHP code example of hyperia / codecept-unittest-generator

1. Go to this page and download the library: Download hyperia/codecept-unittest-generator 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/ */

    

hyperia / codecept-unittest-generator example snippets


/**
 * @PHPUnitGen\<phpunit_assertion_method>(<expectation>:{<parameters...>}) 
 */


// The class to test content

/** @PHPUnitGen\AssertEquals('expected string':{1, 2, 'a string'}) */
/** @PHPUnitGen\AssertTrue(:{4, 5, 'another'}) */
/** @PHPUnitGen\AssertEquals(null) */
/** @PHPUnitGen\AssertNull() */
public function method(int $arg1 = 0, int $arg2 = 0, string $arg3 = 'default') {}


// The generated test for "method" in tests class

$this->assertEquals('expectation string', $this->method(1, 2, 'a string'));
$this->assertTrue($this->method(4, 5, 'another'));
$this->AssertEquals(null, $this->method());
$this->assertNull($this->method());


// The class to test content

/** @PHPUnitGen\Get() */
/** @PHPUnitGen\Set() */