Skip to content

Commit

Permalink
unit test to reproduce single method except issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mbrostami committed Oct 14, 2019
1 parent bec7a7c commit dd0a021
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/_files/ClassWithSinglePublicMethod.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php declare(strict_types=1);
/*
* This file is part of PHPUnit.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

/**
* A class with only one public method
*/
class ClassWithSinglePublicMethod
{
public function falseReturn()
{
return false;
}
}
9 changes: 9 additions & 0 deletions tests/unit/Framework/MockObject/MockBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,13 @@ public function testProvidesAFluentInterface(): void

$this->assertInstanceOf(MockBuilder::class, $spec);
}

public function testExceptMethodFromClassWithSinglePublicMethod(): void
{
$spec = $this->getMockBuilder(ClassWithSinglePublicMethod::class)
->setMethodsExcept(['falseReturn'])
->getMock();

$this->assertFalse($spec->falseReturn());
}
}

0 comments on commit dd0a021

Please sign in to comment.