/** * Test the method to activate the plugin */ public function testActivatePlugin() { Phake::when($this->composer)->getPackage()->thenReturn($this->package); Phake::when($this->package)->getExtra()->thenReturn($this->getExtraConfig()); Phake::when($this->composer)->getConfig()->thenReturn($this->config); $this->autoregister->activate($this->composer, $this->io); $moduleContainer = Accessible::getPropertyValue($this->autoregister, 'moduleContainer'); $finder = Accessible::getPropertyValue($this->autoregister, 'finder'); $parser = Accessible::getPropertyValue($this->autoregister, 'parser'); $manipulator = Accessible::getPropertyValue($this->autoregister, 'manipulator'); $dumper = Accessible::getPropertyValue($this->autoregister, 'dumper'); $this->assertInstanceOf(ModuleContainer::class, $moduleContainer); $this->assertInstanceOf(Finder::class, $finder); $this->assertInstanceOf(RegisterFileParser::class, $parser); $this->assertInstanceOf(AutoloadManipulator::class, $manipulator); $this->assertInstanceOf(AutoloadDumper::class, $dumper); }
/** * Test contents in autoload generated */ public function testContentsInAutoloadGenerated() { $this->clean(); $this->setUpMethodCalled(); $this->autoregister->activate($this->composer, $this->interface); $this->autoregister->moveFile($this->event); $this->autoregister->run($this->event); $this->finder->files()->in(static::VENDOR_DIR); /** @var SplFileInfo $file */ foreach ($this->finder as $file) { if (static::COMPOSER_AUTOLOAD_FILENAME === $file->getFilename()) { $this->assertContains('AppModule\\\\Module\\\\Bundle\\\\TestBundle\\\\', $file->getContents()); } if (static::COMPOSER_AUTOLOAD_CHILD_FILENAME === $file->getFilename()) { $this->assertContains('Symfony\\\\Component\\\\Yaml\\\\', $file->getContents()); } } }