Codeception / Codeception/AspectMock
Class 'yii\base\UnknownClassException' not found
- 主要语言
- PHP
- 星标
- 784
- 派生
- 132
- PR 合并指标
- 30 天内没有已合并 PR
描述
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)
贡献指南
这个仓库没有索引到贡献指南
调研方向
从 BaseYii.php 中的 autoload 方法开始,复现链接的测试快照中所示的已报告 AspectMock 单元测试案例。跟踪为什么即使测试通过也找不到 UnknownClassException;当已报告的 autoload 失败得到解决且不会导致现有通过的测试出现回归时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- php
- 领域
- testing
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100