-
-
Notifications
You must be signed in to change notification settings - Fork 934
Closed
Description
It seems that the static analyser doesn't like Mocking tools.
<?php
namespace Example;
class Book {
private $price;
public function assignPrice(int $price)
{
$this->price = $price;
}
}<?php
namespace Example;
class BookTest {
function it_should_mock_a_book()
{
$mockBook = \Mockery::mock(Book::class);
$mockBook->shouldReceive('assignPrice')
->with(100)
->andReturn(NULL);
}
}➜ mockery vendor/bin/phpstan analyse -l 5 src
2/2 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Line src/Example/BookTest.php
11 Method Mockery\MockInterface::shouldReceive() invoked with 1 parameter, 0 required.
[ERROR] Found 1 error
<?php
namespace Example;
use PHPUnit\Framework\TestCase;
use Prophecy\Prophecy\ObjectProphecy;
class BookTest extends TestCase {
function it_should_mock_a_book()
{
/** @var ObjectProphecy|Book */
$mockBook = $this->prophesize(Book::class);
$mockBook->assignPrice(100)->willReturn(null);
}
}➜ mockery vendor/bin/phpstan analyse -l 5 src
2/2 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
Line src/Example/BookTest.php
15 Call to an undefined method Prophecy\Prophecy\ObjectProphecy::assignPrice().
[ERROR] Found 1 error
fesor, lucasvanlierop, adaamz and hugochinchilla
Metadata
Metadata
Assignees
Labels
No labels