<?php use Peridot\Concurrency\Configuration; use Peridot\Configuration as CoreConfiguration; describe('Configuration', function () { context('when attempting to access an unknown method', function () { it('should delegate to core configuration', function () { $core = new CoreConfiguration(); $core->setGrep('*.test.php'); $config = new Configuration($core); expect($config->getGrep())->to->equal('*.test.php'); }); it('should throw an exception if method does not exist', function () { $core = new CoreConfiguration(); $config = new Configuration($core); expect([$config, 'getMysteryValue'])->to->throw('BadMethodCallException'); }); }); describe('process accessors', function () { it('should allow access to process configuration property', function () { $config = new Configuration(new CoreConfiguration()); expect($config->getProcesses())->to->equal(5); $config->setProcesses(4); expect($config->getProcesses())->to->equal(4); }); }); });
<?php use Peridot\Configuration; use Peridot\Concurrency\Environment\Reader; describe('Reader', function () { beforeEach(function () { $configuration = new Configuration(); //write config to environment $configuration->setDsl(__FILE__); $configuration->setGrep('*.test.php'); $configuration->setPath('/path/to/tests'); $configuration->setReporter('reporter'); $configuration->disableColors(); $configuration->stopOnFailure(); $this->configuration = $configuration; $this->reader = new Reader(new Configuration()); }); describe('->getConfiguration()', function () { it('should fetch a configuration object populated by environment', function () { $config = $this->reader->getConfiguration(); expect($config->getDsl())->to->equal($this->configuration->getDsl()); expect($config->getGrep())->to->equal($this->configuration->getGrep()); expect($config->getPath())->to->equal($this->configuration->getPath()); expect($config->getReporter())->to->equal($this->configuration->getReporter()); expect($config->areColorsEnabled())->to->equal($this->configuration->areColorsEnabled()); expect($config->shouldStopOnFailure())->to->equal($this->configuration->shouldStopOnFailure()); }); }); });