mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-03-18 05:04:51 +08:00
test --enable-openssl option for skipped
This commit is contained in:
parent
f5cbce5195
commit
299f36dcc0
@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace Tests\ZM\Utils;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Throwable;
|
||||
use ZM\Annotation\CQ\CQCommand;
|
||||
use ZM\API\CQ;
|
||||
use ZM\Event\EventManager;
|
||||
@ -157,16 +158,27 @@ class MessageUtilTest extends TestCase
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Throwable
|
||||
*/
|
||||
public function testDownloadCQImage(): void
|
||||
{
|
||||
if (file_exists(DataProvider::getDataFolder('images') . '/test.jpg')) {
|
||||
unlink(DataProvider::getDataFolder('images') . '/test.jpg');
|
||||
}
|
||||
$msg = '[CQ:image,file=test.jpg,url=https://zhamao.xin/file/hello.jpg]';
|
||||
$result = MessageUtil::downloadCQImage($msg);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertFileExists(DataProvider::getDataFolder('images') . '/test.jpg');
|
||||
unlink(DataProvider::getDataFolder('images') . '/test.jpg');
|
||||
|
||||
try {
|
||||
$result = MessageUtil::downloadCQImage($msg);
|
||||
$this->assertIsArray($result);
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertFileExists(DataProvider::getDataFolder('images') . '/test.jpg');
|
||||
unlink(DataProvider::getDataFolder('images') . '/test.jpg');
|
||||
} catch (Throwable $e) {
|
||||
if (strpos($e->getMessage(), 'enable-openssl') !== false) {
|
||||
$this->markTestSkipped('OpenSSL is not enabled');
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user