Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
PHPUnit Configuration does not work as described.

  • First, I want to reference a prior question on this form from 2014:


    Rather than Necro post, I am starting a new topic here and would like to quote from the oil.php configuration file:


    /**
    * These phpunit settings allow oil to run your project's phpunit
    * tests. If you've installed phpunit as a global install via
    * pear, then the defaults don't need to be changed. But if you've
    * installed phpunit via some other method such as Composer,
    * you'll need to update these settings to reflect that.
    *
    * autoload_path - the path to PHPUnit's Autoload.php file.
    * binary_path - the full path you'd type into the command line
    *  to run phpunit from an arbitrary directory.
    *
    * For example, if you've installed phpunit via Composer, your
    * autoload_path will probably be something like:
    *     'autoload_path' => VENDORPATH.'phpunit/phpunit/PHPUnit/Autoload.php',
    * and your binary path will probably be something like:
    *     'binary_path' => VENDORPATH.'bin/phpunit',
    *
    * At present, there is no support for phpunit.phar.
    */

    'autoload_path' => 'PHPUnit/Autoload.php' ,
    'binary_path'   => 'phpunit' ,

    It says, "binary_path - the full path you'd type into the command line."

    However, the actual implementation shown in the referenced prior question (and in the most current code I have) does not seem to support this.


    $phpunit_command = \Config::get('oil.phpunit.binary_path', 'phpunit');

    // Check if we might be using the phar library
    $is_phar = false;
    foreach(explode(':', getenv('PATH')) as $path)
    {
    if (is_file($path.DS.$phpunit_command))
    {
    $handle = fopen($path.DS.$phpunit_command, 'r');
    $is_phar = fread($handle, 18) == '#!/usr/bin/env php';
    fclose($handle);
    if ($is_phar)
    {
    break;
    }
    }
    }

    This code allows you to change the name of the executable file but does not allow you to specify a full path to the executable.

    If I am incorrect then please teach me. Otherwise, how shall I report a bug? I can submit a fix but I'm not certain which behavior is the desirable behavior.


  • I think a non-breaking fix to this code would be the best solution.
  • Nevermind. Everything runs fine after specifying a correct autoload path. Prior to entering a correct path, oil spits out missing path errors on phpunit.

  • Nevermind. Everything runs fine after specifying a correct autoload path. Prior to entering a correct path, oil spits out missing path errors on phpunit.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion