Skip to content

EasyMock::spy() fails to assert that the method is actually called at least once #1

@jdreesen

Description

@jdreesen

While refactoring the factory definition tests for PHP-DI I noticed that EasyMock::spy() fails to assert that the method is actually called at least once.

Sadly it seems I don't know how to write a (failing) test for this behaviour, even if I just tried for about half an our :(

Although the current test does nothing it should actually fail, but it doesn't.

To reproduce this you can try the following:

// Should throw "Expected invocation at least once but it never occured", but it doesn't.
EasyMock::spy('My\Class', [
    'sayHello' => 'Hello',
]);
// Throws exception with message: "Expected invocation at least once but it never occured"
$this->getMock('My\Class')
            ->expects($this->atLeastOnce())
            ->method('sayHello');

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions