PHP code example of yegortokmakov / phprtest

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

    

yegortokmakov / phprtest example snippets




class ImportTest extends \Phprtest\TestSuite
{
    /**
     * @assert memoryUsage 6.5M 10M
     * @assert timeUsage 0.05
     */
    public function testImportCommand()
    {
        $app = new \Symfony\Component\Console\Application('Myapp', 1);
        $app->add(new \Myapp\Command\Import('import'));
        $app->run(new ArgvInput(['myapp', 'import']));
    }
}



class ImportTest extends \Phprtest\TestSuite
{
    /**
     * @assert memoryUsage 6M 10M
     * @assert timeUsage 0.05
     * @provider applicationProvider
     */
    public function testImportCommand($app)
    {
        $app->run(new ArgvInput(['myapp', 'import']));
    }

    public function applicationProvider()
    {
        $app = new \Symfony\Component\Console\Application('Myapp', 1);
        $app->add(new \Myapp\Command\Import('import'));

        return $app;
    }
}



class ImportTest extends \Phprtest\TestSuite
{
    /**
     * @assert memoryUsage 6M 10M
     * @assert timeUsage 0.05
     * @repeat 5
     */
    public function testImportCommand($app)
    {
        $app = new \Symfony\Component\Console\Application('Myapp', 1);
        $app->add(new \Myapp\Command\Import('import'));
        $app->run(new ArgvInput(['myapp', 'import']));
    }
}
bash
php composer.phar