Codeception / Codeception/AspectMock

Class 'yii\base\UnknownClassException' not found

Open
#173 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
784
Forks
132
PR merge metrics
No merged PRs in 30d

Description

While using `AspectMock` for unit testing, the `autoload` method in `BaseYii.php` can not find the following class:
> Class 'yii\base\UnknownClassException' not found

However tests are passing successfully.
```
public static function autoload($className)
{
if (isset(static::$classMap[$className])) {
$classFile = static::$classMap[$className];
if ($classFile[0] === '@') {
$classFile = static::getAlias($classFile);
}
} elseif (strpos($className, '\\') !== false) {
$classFile = static::getAlias('@' . str_replace('\\', '/', $className) . '.php', false);
if ($classFile === false || !is_file($classFile)) {
return;
}
} else {
return;
}

include $classFile;

if (YII_DEBUG && !class_exists($className, false) && !interface_exists($className, false) && !trait_exists($className, false)) {
throw new UnknownClassException("Unable to find '$className' in file: $classFile. Namespace missing?"); // <---
}
}
```
[Test snapshot](https://www.screencast.com/t/1suVpY4O1bj)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.