hlogeon/codeception-doctrine-mongo
最新稳定版本:1.2
Composer 安装命令:
composer require hlogeon/codeception-doctrine-mongo
包简介
Module provides Codeception integration with Doctrine MongoDB ODM
README 文档
README
Allows integration and testing for projects with Doctrine MongoDB ODM. DoctrineMongoOdm uses DocumentManager to perform all database operations.
You should specify a callback function to receive entity manager:
modules:
enabled:
- DoctrineMongoOdm:
connection_callback: ['MyDb', 'createDocumentManager']
This will use static method of MyDb::createDocumentManager() to establish DocumentManager.
Status
- Maintainer: hlogeon
- Stability: unstable
- Contact: hlogeon1@gmail.com
Config
- connection_callback: - callable that will return an instance of DocumentManager. This is a must.
Example (functional.suite.yml)
modules:
enabled: [DoctrineMongoOdm]
config:
DoctrineMongoOdm:
cleanup: false
Public Properties
dm- Document Manager
Actions
dontSeeInRepository
Flushes changes to database and performs ->findOneBy() call for current repository.
param$entityparam array$params
flushToDatabase
Performs $dm->flush();
grabFromRepository
Selects field value from repository. It builds query based on array of parameters. You can use entity associations to build complex queries.
Example:
<?php $email = $I->grabFromRepository('User', 'email', array('name' => 'davert')); ?>
param$entityparam$fieldparam array$paramsreturnarray
haveInRepository
Persists record into repository.
This method crates an entity, and sets its properties directly (via reflection).
Setters of entity won't be executed, but you can create almost any entity and save it to database.
Returns id using getId of newly created entity.
$I->haveInRepository('Entity\User', array('name' => 'davert'));
persistEntity
Adds entity to repository and flushes. You can redefine it's properties with the second parameter.
Example:
<?php $I->persistEntity(new \Entity\User, array('name' => 'Miles')); $I->persistEntity($user, array('name' => 'Miles'));
param$objparam array$values
seeInRepository
Flushes changes to database executes a query defined by array. It builds query based on array of parameters. You can use entity associations to build complex queries.
Example:
<?php $I->seeInRepository('User', array('name' => 'davert')); $I->seeInRepository('User', array('name' => 'davert', 'Company' => array('name' => 'Codegyre'))); $I->seeInRepository('Client', array('User' => array('Company' => array('name' => 'Codegyre'))); ?>
Fails if record for given criteria can't be found,
param$entityparam array$params
统计信息
- 总下载量: 9.12k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2016-10-20