maslosoft/codeception-reflection-asserts
最新稳定版本:1.0.0
Composer 安装命令:
composer require maslosoft/codeception-reflection-asserts
包简介
Reflection-based assertions for Codeception & PHPUnit
README 文档
README
This asserts module is prepared to test code generation tools to assert existing of classes, methods, properties.
Installation and configuration
Use composer to install:
composer require maslosoft/maslosoft/codeception-reflection-asserts
Add to tests/unit.suite.yml:
actor: UnitTester suite_namespace: Tests\Unit modules: enabled: - \Maslosoft\Codeception\Module\ReflectionAsserts
Usage
Using in cest/cept
$I->assertMethodExists(Foo::class, 'bar'); $I->assertMethodIsPublic(Foo::class, 'bar'); $I->assertPropertyExists(Foo::class, 'baz'); $I->assertPropertyIsPrivate(Foo::class, 'baz'); $I->assertMethodHasParameter( Foo::class, 'bar', 'limit', type: 'int', allowsNull: false, optional: true );
Using in unit test
<?php ... class SomeTest extends Unit { use Maslosoft\Testing\Reflection\ReflectionAssertionsTrait; function testMyReflection(): void { $this->assertClassExists(SomeService::class); $this->assertMethodExists(SomeService::class, 'handle'); $this->assertMethodIsPublic(SomeService::class, 'handle'); $this->assertMethodHasParameter( SomeService::class, 'handle', 'request', type: Request::class, allowsNull: false, optional: false ); $this->assertPropertyExists(SomeService::class, 'repository'); $this->assertPropertyIsPrivate(SomeService::class, 'repository'); } }
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-13