PHP code example of i3bepb / reflection-for-test

1. Go to this page and download the library: Download i3bepb/reflection-for-test 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/ */

    

i3bepb / reflection-for-test example snippets


  
use I3bepb\ReflectionForTest\AccessToMethod;
use PHPUnit\Framework\TestCase;

class AnyTest extends TestCase
{
    use AccessToMethod;

    /**
     * Any test.
     *
     * @test
     *
     * @throws \ReflectionException
     */
    public function any_test()
    {
        $object = new ClassWithPrivateMethod();

        // In $resultPrivateMethod result after call private method
        $resultPrivateMethod = $this->privateMethodWithParameters($object, 'privateMethod', ['abc', 123]);
        
        // Any test...
    }



docker pull php:7.0.33-cli-alpine

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('sha384', 'composer-setup.php') === '55ce33d7678c5a611085589f1f3ddf8b3c52d662cd01d4ba75c0ee0459970c2200a51f492d557530c71c15d8dba01eae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

php composer.phar install