Changeset 687

Show
Ignore:
Timestamp:
03/16/08 15:13:03 (10 months ago)
Author:
tswicegood
Message:

throws an exception if no docblock is available (fixes #53)

Location:
DocTest/trunk
Files:
4 added
1 modified

Legend:

Unmodified
Added
Removed
  • DocTest/trunk/src/PHPT/DocTest/Generator.php

    r683 r687  
    3131            $reflection = new ReflectionClass($callback); 
    3232        } 
    33         $docblock = new PHPT_DocTest_DocBlock($reflection->getDocComment()); 
     33        $docblock = $this->_createDocBlock($reflection); 
    3434        $parser = new PHPT_DocTest_Parser($docblock); 
    3535 
    3636        file_put_contents($this->_test_path . '/' . $callback . '-1.phpt', (string)$parser); 
    3737    } 
     38 
     39    private function _createDocBlock($reflection) 
     40    { 
     41        $raw = $reflection->getDocComment(); 
     42        if (empty($raw)) { 
     43            throw new PHPT_DocTest_Generator_NoDocblockException(); 
     44        } 
     45        return new PHPT_DocTest_DocBlock($raw); 
     46    } 
    3847} 
    3948