Skip to content

Commit

Permalink
update: 完善测试
Browse files Browse the repository at this point in the history
  • Loading branch information
NHZEX committed Oct 30, 2023
1 parent 8086c19 commit 8809709
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 1 deletion.
31 changes: 30 additions & 1 deletion tests/CodeRewriteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function getLogs(): array
}
};

$crg = new CodeRewriteGenerator($logger, false);
$crg = new CodeRewriteGenerator($logger, true);

$handle = $crg->generate($filename);

Expand Down Expand Up @@ -167,5 +167,34 @@ class no_namespace_class extends \stdClass
}
PHP,
];

yield [
__DIR__ . '/Stub/TestEnum.php',
<<<PHP
<?php
declare(strict_types=1);
namespace Imiphp\Tests\Stub;
use Imi\Enum\Annotation\EnumItem;
use Imi\Enum\BaseEnum;
class TestEnum extends BaseEnum
{
#[EnumItem(text: '甲', other: 'a1')]
public const A = 1;
#[EnumItem(text: '乙', other: 'b2')]
protected const B = 2;
#[EnumItem(text: '丙', other: 'c3')]
const C = 3;
}
PHP,
];
}
}
26 changes: 26 additions & 0 deletions tests/Stub/TestEnum.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

declare(strict_types=1);

namespace Imiphp\Tests\Stub;

use Imi\Enum\Annotation\EnumItem;
use Imi\Enum\BaseEnum;

class TestEnum extends BaseEnum
{
/**
* @EnumItem(text="甲", other="a1")
*/
public const A = 1;

/**
* @EnumItem(text="乙", other="b2")
*/
protected const B = 2;

/**
* @EnumItem(text="丙", other="c3")
*/
const C = 3;
}
9 changes: 9 additions & 0 deletions tests/Stub/no_namespace_class.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php
declare(strict_types=1);

/**
* Smarty Internal Plugin Compile special Smarty Variable Class.
*/
class no_namespace_class extends \stdClass
{
}

0 comments on commit 8809709

Please sign in to comment.