Is it possible, using PHPUnit mock objects, to expect a call to a magic __call() method?
问题 I've got a mock object in a test. The real object, PageRepository, implements a magic method using __call(), so if you call $pageRepository->findOneByXXXX($value_of_field_XXXX), it will search the database for records matching that parameter. Is there a way to mock that method? The real method call would look something like this: $homepage = $pageRepository->findOneBySlug('homepage'); The test would look like this: $mockPageRepository->expects($this->any()) ->method('findOneBySlug') ->will(