Exemplo n.º 1
0
 /**
  * Prepare the class array with the buildClasses
  */
 private function setBuildClasses()
 {
     if ($this->isBuild === true) {
         return;
     }
     if (count($this->getClasses()) === 0) {
         throw new \Exception('No classes defined, please call setCLasses()');
     }
     $this->buildClasses = [];
     foreach ($this->getOrdererClasses() as $class) {
         $build = new BuildClass();
         $build->setClass($class);
         if ($build->canBeCached() === true) {
             $this->buildClasses[$class->getName()] = $build;
         }
     }
     $this->isBuild = true;
 }
Exemplo n.º 2
0
    /**
     * @covers SpeedLoader\BuildClass::getResult
     */
    public function testGetResult()
    {
        $classRef = new ClassReflection('SpeedLoaderTestAsset\\Simple\\ClassWithBody');
        $buildClass = new BuildClass();
        $buildClass->setClass($classRef);
        $buildClass->setCompressionLevel(BuildClass::COMPRESS_NONE);
        $result = $this->invokeMethod($buildClass, 'getResult');
        $expected = 'namespace SpeedLoaderTestAsset\\Simple {

class ClassWithBody
{ public function test(){} }
}';
        $this->assertEquals($expected, $result);
    }