/**
  * Build the package details from user input.
  *
  * @return \Illuminate\Workbench\Package
  */
 protected function buildPackage()
 {
     list($vendor, $name) = $this->getPackageSegments();
     // get current config
     $config = $this->laravel['config']->get('workbench::config');
     $newconfig = isset($config['composer']);
     // get config options
     $authors = $newconfig ? $config['composer']['authors'] : array($config);
     $license = $newconfig ? $config['composer']['license'] : '';
     $psr0 = $this->option('psr0');
     $namespace = str_replace('\\', '\\\\', preg_replace('/[\\\\]+/', '\\', $this->option('ns')));
     return Package::emptyInst()->vendorProvider($vendor)->nameProvider($name)->authorsProvider($authors)->licenseProvider($license)->psr0Provider($psr0)->namespaceProvider($namespace);
 }
 public function testOldFashionedComposerIntegrity()
 {
     $files = $this->getComposerFiles();
     $composer = $this->helper->getJSON($files['oldfashioned']);
     // check package name
     $this->assertEquals($this->oldfashioned->getFullName(), $composer->name, 'Package name check: ');
     // check authors
     $this->assertCount(2, $composer->authors, 'Authors check: ');
     $this->assertEquals($this->oldfashioned->author, $composer->authors[0]->name, 'Author name check: ');
     $this->assertEquals($this->oldfashioned->email, $composer->authors[0]->email, 'Author email check: ');
     // check autoload
     $psr0 = $this->oldfashioned->vendor . '\\\\' . $this->oldfashioned->name;
     $this->objectHasAttribute($psr0, $composer->autoload->{'psr-0'}, 'Autoload - PSR-0 key check: ');
     $this->assertEquals($composer->autoload->{'psr-0'}->{$psr0}, 'src/', 'Autoload - PSR-0 value check: ');
 }
 public function testGetFullNameGuard()
 {
     $this->assertEquals('evidev/workbench', $this->package->getFullName());
 }
 public function testDefaultPsr0()
 {
     $inst = Package::emptyInst()->vendorProvider($this->obj->vendor)->nameProvider($this->obj->name);
     $this->assertEquals($this->obj->vendor . '\\\\' . $this->obj->name, $inst->psr0);
 }