Closed atakhan closed 1 year ago
It could be because Google_Client
is an alias... try mocking using Google\Client::class
instead. If that doesn't work, it's probably because both Google\Client
and Google_Client
are autoloaded using autoload-files
, which means they've been loaded by the time your call to Mockery::mock
takes place. I am not sure how Mockery
works, but if it relies on a class to not have been autoloaded yet, then this isn't going to work.
I would suggest using prophecy-phpunit instead. This is a great mocking library, and recommended by phpunit.
Hi, thank you for this awesome client, it easy to understand and there is many interesting code tricks in source. My using experience was great while i decide to write a unittest for my job :) My job syncs data from Google analytics service with my local database. And it uses Google_Client. So, i am trying to mock google_client as
$client = \Mockery::mock('overload:'. Google_Client::class)
but there is an errorCould not load mock Google_Client, class already exists
There is no other tests and runInSeparateProcess not helps