#StackBounty: #php #unit-testing #phpunit #mockery Adding interface to mock with Mockery (hard dependency)

Bounty: 50

I need to mock CurrencyEnum by overload it, but it’s not the end becouse i need to add interface to this mock.
This doesn’t work:


Error: (..) must be an instance of BaseCurrency, instance of CurrencyEnum given.
I looked at MockeryContainer::mock and I dont’t have idea how to do it.
In example I want to test TestingClass::first() method

class CurrencyEnum implements BaseCurrency
    /* methods */

class TestingClass
    public function first(string $currencySymbol)
        $abc = 'some_string';

        return $this->second($abc, new CurrencyEnum($currencySymbol));

    private function second(string $abc, BaseCurrency $currency)
        /* code */

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.