Esempio n. 1
0
 /**
  * Registers mocked Builder and Build classes so that realistic plugins
  * can be tested.
  */
 private function registerBuildAndBuilder()
 {
     $this->testedFactory->registerResource(function () {
         return $this->getMock('PHPCI\\Builder', array(), array(), '', false);
     }, null, 'PHPCI\\Builder');
     $this->testedFactory->registerResource(function () {
         return $this->getMock('PHPCI\\Model\\Build', array(), array(), '', false);
     }, null, 'PHPCI\\Model\\Build');
 }
Esempio n. 2
0
 /**
  * Returns a configured instance of the plugin factory.
  *
  * @param Build $build
  * @return PluginFactory
  */
 private function buildPluginFactory(Build $build)
 {
     $pluginFactory = new PluginFactory();
     $self = $this;
     $pluginFactory->registerResource(function () use($self) {
         return $self;
     }, null, 'PHPCI\\Builder');
     $pluginFactory->registerResource(function () use($build) {
         return $build;
     }, null, 'PHPCI\\Model\\Build');
     $logger = $this->logger;
     $pluginFactory->registerResource(function () use($logger) {
         return $logger;
     }, null, 'Psr\\Log\\LoggerInterface');
     $pluginFactory->registerResource(function () use($self) {
         $factory = new MailerFactory($self->getSystemConfig('phpci'));
         return $factory->getSwiftMailerFromConfig();
     }, null, 'Swift_Mailer');
     return $pluginFactory;
 }