<?php

use Evenement\EventEmitterInterface;
use Peridot\Reporter\Dot\DotReporterPlugin;
use cloak\peridot\CloakPlugin;
use expectation\peridot\ExpectationPlugin;
use holyshared\peridot\temporary\TemporaryPlugin;
return function (EventEmitterInterface $emitter) {
    ExpectationPlugin::create()->registerTo($emitter);
    TemporaryPlugin::create()->registerTo($emitter);
    new DotReporterPlugin($emitter);
};
    describe('#registerTo', function () {
        beforeEach(function () {
            $this->prophet = new Prophet();
            $emitter = $this->prophet->prophesize(EventEmitterInterface::class);
            $emitter->on(TemporaryPlugin::START_EVENT, Argument::type('array'))->shouldBeCalled();
            $this->emitter = $emitter->reveal();
            $this->plugin = TemporaryPlugin::create();
        });
        it('register plugin', function () {
            $this->plugin->registerTo($this->emitter);
            $this->prophet->checkPredictions();
        });
    });
    describe('#onSuiteStart', function () {
        beforeEach(function () {
            $this->suite = new Suite('Plugin', function () {
            });
            $this->plugin = TemporaryPlugin::create();
            $this->plugin->onSuiteStart($this->suite);
        });
        it('add scope', function () {
            $scope = $this->suite->getScope();
            $childScopes = $scope->peridotGetChildScopes();
            expect($childScopes)->toHaveLength(1);
        });
        it('add teardown function', function () {
            $callbacks = $this->suite->getTearDownFunctions();
            expect($callbacks)->toHaveLength(1);
        });
    });
});