コード例 #1
0
 public function testIncludePathsInMainPackage()
 {
     $package = new Package('a', '1.0', '1.0');
     $package->setIncludePaths(array('/lib', '/src'));
     $packages = array($a = new Package("a/a", "1.0", "1.0"));
     $a->setIncludePaths(array("lib/"));
     $this->repository->expects($this->once())->method("getCanonicalPackages")->will($this->returnValue($packages));
     mkdir($this->vendorDir . "/composer", 0777, true);
     $this->generator->dump($this->config, $this->repository, $package, $this->im, "composer", false, '_12');
     $oldIncludePath = get_include_path();
     require $this->vendorDir . "/autoload.php";
     $this->assertEquals($this->workingDir . "/lib" . PATH_SEPARATOR . $this->workingDir . "/src" . PATH_SEPARATOR . $this->vendorDir . "/a/a/lib" . PATH_SEPARATOR . $oldIncludePath, get_include_path());
     set_include_path($oldIncludePath);
 }
コード例 #2
0
 public function testIncludePathsArePrependedInAutoloadFile()
 {
     $package = new Package('a', '1.0', '1.0');
     $packages = array();
     $a = new Package("a/a", "1.0", "1.0");
     $a->setIncludePaths(array("lib/"));
     $packages[] = $a;
     $this->repository->expects($this->once())->method("getPackages")->will($this->returnValue($packages));
     mkdir($this->vendorDir . "/composer", 0777, true);
     $this->generator->dump($this->config, $this->repository, $package, $this->im, "composer", false, '_11');
     $oldIncludePath = get_include_path();
     // suppress the class loader to avoid fatals if the class is redefined
     file_put_contents($this->vendorDir . '/composer/ClassLoader.php', '');
     require $this->vendorDir . "/autoload.php";
     $this->assertEquals($this->vendorDir . "/a/a/lib" . PATH_SEPARATOR . $oldIncludePath, get_include_path());
     set_include_path($oldIncludePath);
 }