thenlabs / pyramidal-tests
v1.1.1
2020-07-05 20:33 UTC
Requires
- phpunit/phpunit: ^7.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.12
README
PHPUnit 的一个互补框架,侧重于简单性、可重用性和故事叙述。
如果喜欢这个项目,请给我们一颗 ⭐。
文档。
安装。
$ composer require --dev thenlabs/pyramidal-tests 2.0.x-dev
该项目仍在开发中。
示例
<?php // tests/test-it-is-created-a-product.php testCase('it is created a product', function () { setUp(function () { $this->product = new Product(); }); test('the product has not name', function () { $this->assertEmpty($this->product->getName()); }); test('not contains categories', function () { $this->assertCount(0, $this->product->getCategories()); }); testCase('adds a category to the product', function () { setUp(function () { $this->category = $this->createMock(Category::class); $this->product->addCategory($this->category); }); test('the product contains the category', function () { $this->assertContains($this->category, $this->product->getCategories()); }); }); });
执行
$ ./vendor/bin/pyramidal --testdox
--testdox参数是可选的。
结果
PyramidalTests 2.x.x by Andy Daniel Navarro Taño and contributors.
PHPUnit 9.5.x by Sebastian Bergmann and contributors.
it is created a product
✔ the product has not name
✔ not contains categories
adds a category to the product
✔ the product contains the category
Time: 00:00.009, Memory: 6.00 MB
OK (3 tests, 3 assertions)
开发。
运行测试。
$ composer test