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();
});