elstc/codeception-cakefixture
Composer 安装命令:
composer require elstc/codeception-cakefixture
包简介
CakePHP Fixture loader for Codeception
README 文档
README
This Codeception module can be able load CakePHP Fixutre in your test case.
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require --dev elstc/codeception-cakefixture
Then enable this module in your test suite configration file (eg: acceptance.suite.yml, functional.suite.yml, and etc...):
modules:
enabled:
- CakeFixture
See: 06-ModulesAndHelpers - Codeception - Documentation
If you have not yet read the CakePHP bootstrap file with in the Codeception bootstrap, then load it:
<?php // your tests/_bootstrap.php require_once '__YOUR_CAKEPHP_CONFIG_PATH__/bootstrap.php';
Usage
Cest
In your Cest test case, write $fixutures property:
class AwesomeCest { public $fixtures = [ 'app.users', 'app.posts', ]; // ... }
You can use $autoFixtures, $dropTables property, and loadFixtures() method:
class AwesomeCest { public $autoFixtures = false; public $dropTables = false; public $fixtures = [ 'app.users', 'app.posts', ]; public function tryYourSenario($I) { // load fixtures manually $I->loadFixtures('Users', 'Posts'); // or load all fixtures $I->loadFixtures(); // ... } }
Cept
In your Cept test case, use $I->useFixtures() and $I->loadFixtures():
$I = new FunctionalTester($scenario); // You should call `useFixtures` before `loadFixtures` $I->useFixtures('app.users', 'app.posts'); // Then load fixtures manually $I->loadFixtures('Users', 'Posts'); // or load all fixtures $I->loadFixtures();
Configuration options
debug
Pass to FixtureManager's debug option.
default: false
autoFixures
Default $autoFixtures property.
default: true
dropTables
Default $dropTables property.
default: true
elstc/codeception-cakefixture 适用场景与选型建议
elstc/codeception-cakefixture 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.21k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2017 年 12 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 elstc/codeception-cakefixture 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 elstc/codeception-cakefixture 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.21k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-12-11