#StackBounty: #php Codeception/AspectMock Parent class not found by locator

Bounty: 50

I have a problem with Codeception/AspectMock.
When using custom autoloader and try to create an instance of a class which has parent form the same custom namespace I have this error:

PHP Fatal error: Uncaught InvalidArgumentException: Class [parent
class name] was not found by locator in

I have very simple setup:


require_once __DIR__ . '/vendor/autoload.php';

$kernel = AspectMockKernel::getInstance();
    'debug' => true,
    'includePaths' => [__DIR__. '/lib'],
$kernel->loadFile(__DIR__ . '/autoload.php'); // custom autoloader

$b = new libB();

Class libB:

namespace lib;

class B extends A {}

Class libA:

namespace lib;

class A
    public function getName()
        return static::class;

Class B is loaded via my custom autoloader, but then the locator tries to load parent class A via composer autoloader and returns this error. Is this a bug, or I’m doing something wrong?

Get this bounty!!!

Leave a Reply

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