Skip to content

Commit

Permalink
Fix test using mocked reflection class
Browse files Browse the repository at this point in the history
  • Loading branch information
sgiehl committed Oct 17, 2024
1 parent 014a444 commit fb1c343
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions tests/PHPUnit/Integration/DocumentationGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Piwik\API\DocumentationGenerator;
use Piwik\API\Proxy;
use Piwik\EventDispatcher;
use ReflectionClass;

/**
* @group Core
Expand All @@ -21,14 +22,9 @@ class DocumentationGeneratorTest extends TestCase
{
public function testCheckIfModuleContainsHideAnnotation()
{
$annotation = '@hideExceptForSuperUser test test';
$mock = $this->getMockBuilder('ReflectionClass')
->disableOriginalConstructor()
->onlyMethods(array('getDocComment'))
->getMock();
$mock->expects($this->once())->method('getDocComment')->willReturn($annotation);
$refelction = new ReflectionClass(DocumentationGenerator::class);
$documentationGenerator = new DocumentationGenerator();
$this->assertTrue($documentationGenerator->checkIfClassCommentContainsHideAnnotation($mock));
$this->assertTrue($documentationGenerator->checkIfClassCommentContainsHideAnnotation($refelction));
}

public function testCheckDocumentation()
Expand Down

0 comments on commit fb1c343

Please sign in to comment.