/** * Get a simple copy of the package. * * @return Package */ public function getPackageCopy() { $copy = new Package($this->package->getName(), $this->package->getVersion(), $this->package->getPrettyVersion()); $copy->setType($this->package->getType()); $copy->setExtra($this->package->getExtra()); return $copy; }
public function testGetPackageCopy() { $this->initJob([], $this->atLeastOnce()); $this->package->expects($this->atLeastOnce())->method('getName')->will($this->returnValue('foo/bar')); $this->package->expects($this->atLeastOnce())->method('getVersion')->will($this->returnValue('1.0.0')); $this->package->expects($this->atLeastOnce())->method('getPrettyVersion')->will($this->returnValue('1')); $this->package->expects($this->atLeastOnce())->method('getType')->will($this->returnValue('lib')); $copy = $this->job->getPackageCopy(); // test $this->assertInstanceOf('\\Composer\\Package\\Package', $copy); $this->assertEquals($this->package->getName(), $copy->getName()); $this->assertEquals($this->package->getVersion(), $copy->getVersion()); $this->assertEquals($this->package->getPrettyVersion(), $copy->getPrettyVersion()); $this->assertEquals($this->package->getType(), $copy->getType()); $this->assertEquals($this->package->getExtra(), $copy->getExtra()); }
/** * Get the webroot data * * @return string */ private function getWebroot() { $extraData = $this->package->getExtra(); return $extraData['webroot-dir']; }