PHP code example of cekurte / tdd

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

    

cekurte / tdd example snippets




namespace Your\Namespace;

use Cekurte\Tdd\ReflectionTestCase;

class YourClassTest extends ReflectionTestCase
{
    public function testAnything()
    {
        // Instance of a class that has one
        // private property named "yourPrivateProperty".
        $instance = new YourClass();

        // Set the value "newValue" to the property
        // "yourPrivateProperty".
        $this->propertySetValue(
            $instance,
            'yourPrivateProperty',
            'newValue'
        );

        // ...
    }
}



namespace Your\Namespace;

use Cekurte\Tdd\ReflectionTestCase;

class YourClassTest extends ReflectionTestCase
{
    public function testAnything()
    {
        // Instance of a class that has one
        // private property named "yourPrivateProperty".
        $instance = new YourClass();

        // Get the value of the property
        // "yourPrivateProperty".
        $currentValue = $this->propertyGetValue(
            $instance,
            'yourPrivateProperty'
        );

        // ...
    }
}



namespace Your\Namespace;

use Cekurte\Tdd\ReflectionTestCase;

class YourClassTest extends ReflectionTestCase
{
    public function testAnything()
    {
        // Instance of a class that has one
        // private property named "yourPrivateMethod".
        $instance = new YourClass();

        // Call the method
        // "yourPrivateMethod".
        $valueReturned = $this->invokeMethod(
            $instance,
            'yourPrivateMethod',
            ['param1', 'param2', 'paramN']
        );

        // ...
    }
}