<?php
namespace UnitTestFiles\Test;
use PHPUnit\Framework\TestCase;

class PHPFileTest extends TestCase
{
    /**
     * @dataProvider additionProvider
     */
    public function testAdd($val, $expected)
    {
        $match_val = $val;
        $random = substr(md5(mt_rand()), 0, 7);
        $input_code = '<?php 
        $user_input = "' . $val . '";';
        $filePath = "/var/www/html/FFMPEG-CRON-JOB/ide/temp/unit_" . $random. ".php";
        $unitTestfilePath = "/var/www/html/FFMPEG-CRON-JOB/ide/temp/php_test.php";
        $code = file_get_contents($unitTestfilePath);
        $programFile = fopen($filePath, "w");
        fwrite($programFile, $input_code . $code);
        fclose($programFile);
        $get = require($filePath);
        $this->expectOutputString($expected);
        unlink($filePath);
        // shell_exec("del ".$filePath." ");
        // $this->assertEquals($expected, $match_val);
    }

    public function additionProvider()
    {
        return [
            ["1 1 1", 3],
            ["15 15", 30],
            ["25 25", 50],
        ];
    }
}

?>