public function testIgnoreImportsFromSameNamespace()
    {
        $this->class->setClassName('Puli\\MyClass');
        $this->class->addImport(new Import('IteratorAggregate'));
        $this->class->addImport(new Import('Puli\\SomeClass'));
        $this->class->addImport(new Import('Acme\\OtherClass'));
        $this->writer->writeClass($this->class);
        $expected = <<<EOF
<?php

namespace Puli;

use Acme\\OtherClass;
use IteratorAggregate;

class MyClass
{
}

EOF;
        $this->assertFileSame($expected, $this->tempDir . '/MyClass.php');
    }
Exemple #2
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testSetClassNameFailsIfNoString()
 {
     $this->class->setClassName(1234);
 }