mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 10:07:12 +00:00
- Improve MetaCommand to allow to ignore some abstract names
- Auto-correct `Method` FQN type name if missing first \ - Implement unit-tests
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php namespace Barryvdh\LaravelIdeHelper;
|
||||
|
||||
class MethodTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* @expectedException \PHPUnit_Framework_Error
|
||||
* @expectedExceptionMessage Argument 1 passed to
|
||||
*/
|
||||
public function testConstructorWithoutMethod()
|
||||
{
|
||||
new Method(null, null, null);
|
||||
}
|
||||
|
||||
public function testConstructor()
|
||||
{
|
||||
$method = new \ReflectionMethod('PHPUnit_Framework_TestCase', 'getMock');
|
||||
$object = new Method($method, null, new \ReflectionClass(get_class($this)));
|
||||
|
||||
$this->assertSame('\PHPUnit_Framework_TestCase', $object->getDeclaringClass());
|
||||
$this->assertSame('\\' . get_class($this), $object->getRoot());
|
||||
$this->assertSame('getMock', $object->getName());
|
||||
|
||||
$prop = new \ReflectionProperty(get_class($object), 'namespace');
|
||||
$prop->setAccessible(true);
|
||||
$this->assertSame('', $prop->getValue($object));
|
||||
|
||||
$this->assertFalse($object->isDeprecated());
|
||||
$this->assertCount($method->getNumberOfParameters(), $object->getDocParams());
|
||||
|
||||
$doc = $object->getDocComment('', true);
|
||||
$this->assertContains("\n * " . '@param array|null $methods', $doc);
|
||||
$this->assertContains("\n * " . '@return \PHPUnit_Framework_MockObject_MockObject', $doc);
|
||||
$this->assertContains("\n * " . '@throws \PHPUnit_Framework_Exception', $doc);
|
||||
|
||||
$this->assertTrue($object->shouldReturn());
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user