コード例 #1
0
ファイル: FileSpec.php プロジェクト: thomasruiz/file-modifier
 /**
  * Has namespaces
  */
 function it_has_namespaces(PHPNamespace $namespace, PHPNamespace $namespaceAdded)
 {
     $this->getNamespaces()->shouldBe([$namespace]);
     $namespace->getName()->willReturn(PHPNamespace::NO_NAMESPACE);
     $namespace->isEmpty()->willReturn(true);
     $this->addNamespace($namespace);
     $this->getNamespaces()->shouldBe([$namespace]);
     $namespace->isEmpty()->willReturn(false);
     $namespace->setName(PHPNamespace::GLOBAL_NAMESPACE)->shouldBeCalled();
     $this->addNamespace($namespaceAdded);
     $this->getNamespaces()->shouldBe([$namespace, $namespaceAdded]);
 }
コード例 #2
0
 /**
  * @param PHPNamespace $namespace
  *
  * @return \PhpParser\Node
  */
 public function generateNamespace(PHPNamespace $namespace)
 {
     $ns = $this->factory->namespace($namespace->getName());
     return $ns->getNode();
 }