mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-24 00:55:35 +08:00
test --enable-openssl option for skipped
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace Tests\ZM\Utils;
|
namespace Tests\ZM\Utils;
|
||||||
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
use Throwable;
|
||||||
use ZM\Annotation\CQ\CQCommand;
|
use ZM\Annotation\CQ\CQCommand;
|
||||||
use ZM\API\CQ;
|
use ZM\API\CQ;
|
||||||
use ZM\Event\EventManager;
|
use ZM\Event\EventManager;
|
||||||
@@ -157,16 +158,27 @@ class MessageUtilTest extends TestCase
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws Throwable
|
||||||
|
*/
|
||||||
public function testDownloadCQImage(): void
|
public function testDownloadCQImage(): void
|
||||||
{
|
{
|
||||||
if (file_exists(DataProvider::getDataFolder('images') . '/test.jpg')) {
|
if (file_exists(DataProvider::getDataFolder('images') . '/test.jpg')) {
|
||||||
unlink(DataProvider::getDataFolder('images') . '/test.jpg');
|
unlink(DataProvider::getDataFolder('images') . '/test.jpg');
|
||||||
}
|
}
|
||||||
$msg = '[CQ:image,file=test.jpg,url=https://zhamao.xin/file/hello.jpg]';
|
$msg = '[CQ:image,file=test.jpg,url=https://zhamao.xin/file/hello.jpg]';
|
||||||
$result = MessageUtil::downloadCQImage($msg);
|
|
||||||
$this->assertIsArray($result);
|
try {
|
||||||
$this->assertCount(1, $result);
|
$result = MessageUtil::downloadCQImage($msg);
|
||||||
$this->assertFileExists(DataProvider::getDataFolder('images') . '/test.jpg');
|
$this->assertIsArray($result);
|
||||||
unlink(DataProvider::getDataFolder('images') . '/test.jpg');
|
$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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user