X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fpsy%2Fpsysh%2Ftest%2FPsy%2FTest%2FUtil%2FDocblockTest.php;fp=vendor%2Fpsy%2Fpsysh%2Ftest%2FPsy%2FTest%2FUtil%2FDocblockTest.php;h=a9aef6887e76cbd12f2996c0610146b67cfe26a7;hp=0000000000000000000000000000000000000000;hb=eba34333e3c89f208d2f72fa91351ad019a71583;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae diff --git a/vendor/psy/psysh/test/Psy/Test/Util/DocblockTest.php b/vendor/psy/psysh/test/Psy/Test/Util/DocblockTest.php new file mode 100644 index 000000000..a9aef6887 --- /dev/null +++ b/vendor/psy/psysh/test/Psy/Test/Util/DocblockTest.php @@ -0,0 +1,96 @@ +getMockBuilder('ReflectionClass') + ->disableOriginalConstructor() + ->getMock(); + + $reflector->expects($this->once()) + ->method('getDocComment') + ->will($this->returnValue($comment)); + + $docblock = new Docblock($reflector); + + $this->assertEquals($body, $docblock->desc); + + foreach ($tags as $tag => $value) { + $this->assertTrue($docblock->hasTag($tag)); + $this->assertEquals($value, $docblock->tag($tag)); + } + } + + public function comments() + { + return array( + array('', '', array()), + array( + '/** + * This is a docblock + * + * @throws \Exception with a description + */', + 'This is a docblock', + array( + 'throws' => array(array('type' => '\Exception', 'desc' => 'with a description')), + ), + ), + array( + '/** + * This is a slightly longer docblock + * + * @param int $foo Is a Foo + * @param string $bar With some sort of description + * @param \ClassName $baz is cool too + * + * @return int At least it isn\'t a string + */', + 'This is a slightly longer docblock', + array( + 'param' => array( + array('type' => 'int', 'desc' => 'Is a Foo', 'var' => '$foo'), + array('type' => 'string', 'desc' => 'With some sort of description', 'var' => '$bar'), + array('type' => '\ClassName', 'desc' => 'is cool too', 'var' => '$baz'), + ), + 'return' => array( + array('type' => 'int', 'desc' => 'At least it isn\'t a string'), + ), + ), + ), + array( + '/** + * This is a docblock! + * + * It spans lines, too! + * + * @tagname plus a description + * + * @return + */', + "This is a docblock!\n\nIt spans lines, too!", + array( + 'tagname' => array('plus a description'), + ), + ), + ); + } +}