mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-03-17 20:54:52 +08:00
Update the test instance
This commit is contained in:
parent
5db3ff934d
commit
d748a20445
@ -59,10 +59,9 @@ class DataProviderTest extends TestCase
|
||||
|
||||
public function testIsRelativePath(): void
|
||||
{
|
||||
$this->assertTrue(true);
|
||||
// $this->assertTrue(DataProvider::isRelativePath('./'));
|
||||
// $this->assertTrue(DataProvider::isRelativePath('../'));
|
||||
// $this->assertFalse(DataProvider::isRelativePath('/'));
|
||||
// $this->assertFalse(DataProvider::isRelativePath('test.php'));
|
||||
$this->assertTrue(DataProvider::isRelativePath('./'));
|
||||
$this->assertTrue(DataProvider::isRelativePath('../'));
|
||||
$this->assertFalse(DataProvider::isRelativePath('/'));
|
||||
$this->assertTrue(DataProvider::isRelativePath('test.php'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,10 @@ use ZM\Event\EventManager;
|
||||
use ZM\Utils\DataProvider;
|
||||
use ZM\Utils\MessageUtil;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* @coversNothing
|
||||
*/
|
||||
class MessageUtilTest extends TestCase
|
||||
{
|
||||
public function testAddShortCommand(): void
|
||||
@ -23,6 +27,8 @@ class MessageUtilTest extends TestCase
|
||||
|
||||
/**
|
||||
* @dataProvider providerTestContainsImage
|
||||
* @param mixed $msg
|
||||
* @param mixed $expected
|
||||
*/
|
||||
public function testContainsImage($msg, $expected): void
|
||||
{
|
||||
@ -37,7 +43,7 @@ class MessageUtilTest extends TestCase
|
||||
'image only' => ['[CQ:image,file=123456.jpg]', true],
|
||||
'image' => ['hello world![CQ:image,file=123456.jpg]', true],
|
||||
'two image' => ['hello world![CQ:image,file=123456.jpg][CQ:image,file=123456.jpg]', true],
|
||||
// 'malformed image' => ['[CQ:image,file=]', false],
|
||||
// 'malformed image' => ['[CQ:image,file=]', false],
|
||||
];
|
||||
}
|
||||
|
||||
@ -55,6 +61,8 @@ class MessageUtilTest extends TestCase
|
||||
|
||||
/**
|
||||
* @dataProvider providerTestArrayToStr
|
||||
* @param mixed $array
|
||||
* @param mixed $expected
|
||||
*/
|
||||
public function testArrayToStr($array, $expected): void
|
||||
{
|
||||
@ -86,6 +94,8 @@ class MessageUtilTest extends TestCase
|
||||
|
||||
/**
|
||||
* @dataProvider providerTestIsAtMe
|
||||
* @param mixed $msg
|
||||
* @param mixed $expected
|
||||
*/
|
||||
public function testIsAtMe($msg, $expected): void
|
||||
{
|
||||
@ -115,6 +125,8 @@ class MessageUtilTest extends TestCase
|
||||
|
||||
/**
|
||||
* @dataProvider providerTestStrToArray
|
||||
* @param mixed $str
|
||||
* @param mixed $expected
|
||||
*/
|
||||
public function testStrToArray($str, $expected): void
|
||||
{
|
||||
@ -138,6 +150,8 @@ class MessageUtilTest extends TestCase
|
||||
|
||||
/**
|
||||
* @dataProvider providerTestSplitCommand
|
||||
* @param mixed $msg
|
||||
* @param mixed $expected
|
||||
*/
|
||||
public function testSplitCommand($msg, $expected): void
|
||||
{
|
||||
@ -158,7 +172,9 @@ class MessageUtilTest extends TestCase
|
||||
|
||||
public function testDownloadCQImage(): void
|
||||
{
|
||||
@unlink(DataProvider::getDataFolder('images') . '/test.jpg');
|
||||
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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user