Peridot\Configuration::setConfigurationFile PHP Method

setConfigurationFile() public method

Set the path to a Peridot configuration file
public setConfigurationFile ( string $configurationFile )
$configurationFile string
    public function setConfigurationFile($configurationFile)
    {
        $search = [$configurationFile, getcwd() . DIRECTORY_SEPARATOR . $configurationFile];
        $found = array_filter($search, 'file_exists');
        if (count($found) == 0) {
            throw new \RuntimeException("Configuration file specified but does not exist");
        }
        $this->write('configurationFile', $found[0]);
        return $this;
    }

Usage Example

use Peridot\Concurrency\Runner\StreamSelect\Model\Suite;
use Peridot\Concurrency\Runner\StreamSelect\Model\Test;
use Peridot\Configuration;
use Prophecy\Argument;
require 'TestMessageReader.php';
describe('Application', function () {
    $this->peridotAddChildScope(new TestMessageReader());
    beforeEach(function () {
        $this->emitter = new EventEmitter();
        $this->readStream = tmpfile();
        $this->writeStream = tmpfile();
        $this->message = new TestMessage($this->writeStream);
        $environment = new Environment($this->emitter, $this->readStream, $this->writeStream);
        $config = new Configuration();
        $config->setDsl(__DIR__ . '/../../../../fixtures/environment/dsl.php');
        $config->setConfigurationFile(__DIR__ . '/../../../../fixtures/environment/peridot.php');
        $reader = $this->getProphet()->prophesize('Peridot\\Concurrency\\Environment\\ReaderInterface');
        $reader->getConfiguration()->willReturn($config);
        $looper = $this->getProphet()->prophesize('Peridot\\Concurrency\\Runner\\StreamSelect\\Application\\LooperInterface');
        $looper->loop(Argument::type('Peridot\\Runner\\Context'), $environment, $this->message)->shouldBeCalled();
        $this->application = new Application($environment, $reader->reveal(), $looper->reveal());
        /**
         * An application does not listen until run.
         */
        $this->application->run($this->message);
    });
    afterEach(function () {
        fclose($this->readStream);
        fclose($this->writeStream);
        $this->getProphet()->checkPredictions();
    });