PHP code example of chornij / console

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

    

chornij / console example snippets




class ReportTest extends \PHPUnit_Framework_TestCase
{

    /**
     * @var Report Report object
     */
    private $report;

    /**
     * @inheritdoc
     */
    public function setUp()
    {
        $this->report = new Report();
        
        echo $this->report->title('Testing some component');
    }
    
    public function testComponent()
    {
        $this->report->write('Start testing', 'blue');
        
        $obj = new Component();
        $obj->attribute = 1234;
        
        $this->assertTrue($obj->isValidated());
        
        $this->report->write($obj->result, 'green');
        
        $this->report->write('XML result:', ['bold', 'magenta']);
        $this->report->writeXml($obj->xmlResult);
    }

}