public function testWriteServiceProviderGuard() { $this->creator->writeServiceProvider($this->package, $this->rootdir->url(), true); $file = $this->rootdir->url() . '/src/' . $this->package->vendor . '/' . $this->package->name . '/' . $this->package->name . 'ServiceProvider.php'; $this->assertFileExists($file); $matches = array(); $this->assertTrue(preg_match('/namespace\\s+([^\\s;]+)/', file_get_contents($file), $matches) === 1); $namespace = $matches[1]; $this->assertEquals($this->package->vendor . '\\' . $this->package->name, $namespace); }
/** * get composer.json files of the created packages * * @return array returns the path of the composer.json file */ private function getServiceProviderFiles() { return array('oldfashioned' => $this->rootdir->url() . '/vendor/old-fashioned/src/' . $this->oldfashioned->vendor . '/' . $this->oldfashioned->name . '/' . $this->oldfashioned->name . 'ServiceProvider.php', 'newpackage' => $this->rootdir->url() . '/vendor/new-package/src/' . preg_replace('/\\/+/', '/', str_replace('\\', '/', $this->newpackage->namespace) . '/') . $this->newpackage->name . 'ServiceProvider.php'); }