我正在尝试将我的 PhpStorm 调试器与 PHPUnit 连接。我正在使用 Docker env,并且 docker PHPUnit 内部工作正常。问题是当我单击“测试”目录 PPM -> 运行测试时
我懂了:
[docker://environment_php_8_fpm:latest/]:php /opt/.phpstorm_helpers/phpunit.php --no-configuration /opt/project/src/tests
Testing started at 16:19 ...
The value of autoloader is specified, but file doesn't exist '/home/kuba/Work/CodeProjects/advertisement-crawler/src/vendor/autoload.php'
Process finished with exit code 1
Run Code Online (Sandbox Code Playgroud)
我试图在谷歌中找到解决方案,但很难找到有用的东西。
@edit此外,我提供了新路径,在单击刷新新路径后我得到了这个路径是:/opt/project/src/vendor/autoload.php

现在,在 phpstorm 中运行此命令后,我收到了新的错误消息
[docker://environment_php_8_fpm:latest/]:php /opt/.phpstorm_helpers/phpunit.php --configuration /opt/project/src/phpunit.xml
Testing started at 18:48 ...
Fatal error: Uncaught Error: Class "PHPUnit_TextUI_ResultPrinter" not found in /opt/.phpstorm_helpers/phpunit.php on line 231
Error: Class "PHPUnit_TextUI_ResultPrinter" not found in /opt/.phpstorm_helpers/phpunit.php on line 231
Call Stack:
0.0006 …Run Code Online (Sandbox Code Playgroud) 我在 Laravel-Eloquent 的方法中找到了updateOrCreate(). 为什么在框架中我们可以找到破坏干净代码和 SOLID 规则的方法?
我在编译这段代码时遇到了这个问题:
./greet.go:11:29: cannot use name (type []string) as type string in argument to CheckStringsAreUppercase
Run Code Online (Sandbox Code Playgroud)
但我不明白为什么。name ...string并且words ...string具有完全相同的类型。这是怎么回事?
func Greet(name ...string) string {
helloWord := "Hello"
if CheckStringsAreUppercase(name) {
return strings.ToUpper(helloWord)
}
return helloWord
}
func CheckStringsAreUppercase(words ...string) bool {
for _, word := range words {
if !CheckStringIsUppercase(word) {
return true
}
}
return true
}
Run Code Online (Sandbox Code Playgroud) 首先我会写一些关于我的测试表的信息。这是 books 表,有 665647 行数据。下面您可以看到它的外观。
我对价格相同的书籍进行了 10 次相同的查询
select * from books where price = 10
Run Code Online (Sandbox Code Playgroud)
所有 10 个查询的执行时间为 9 秒 663 毫秒。
我尝试再次运行相同的 10 个查询。它们的执行时间为 21 秒 996 毫秒。
show index from books;
Run Code Online (Sandbox Code Playgroud)
为我显示了非常有线的数据。可能的值只有一个!
我做错了什么?我确信索引可以使我们的查询更快,而不是更慢。
我发现这个主题:MySQL索引减慢查询速度
,但说实话,我不太理解这一点,尤其是我的表格书中的基数列,此时价格字段有两个可能的值10和30仍然show index from books;显示1

@Edit1 SHOW CREATE TABLE 书籍
结果:
CREATE TABLE `books` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
`description` text COLLATE utf8mb4_unicode_ci NOT NULL,
`isbn` bigint unsigned NOT NULL,
`price` double(8,2) …Run Code Online (Sandbox Code Playgroud)