PHP code example of facile-it / paraunit-testcase

1. Go to this page and download the library: Download facile-it/paraunit-testcase 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/ */

    

facile-it / paraunit-testcase example snippets


class YourCommandTest extends ParaunitFunctionalTestCase
{
    public function testYourCommand()
    {
        $output = $this->runContainerAwareCommandTester(
            new YourCommand(), 
            [
                'argument' => 'argumentValue',
                '--option' => 0,
            ]
        );
        
        $this->assertContains('Execution completed', $output);
    }
}

class YourCommandTest extends ParaunitFunctionalTestCase
{
    public function testYourCommand()
    {
        $commandTester = $this->createContainerAwareCommandTester(new YourCommand());
        $container = $commandTester->getCommandContainer();
        // do what you want to the container!
        
        $commandTester->execute(
            [
                'argument' => 'argumentValue',
                '--option' => 0,
            ]
        );
        
        $this->assertEquals(0, $commandTester->getStatusCode());
        $this->assertContains('Execution completed', $commandTester->getDisplay());
    }
}