定制 hlogeon/codeception-doctrine-mongo 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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

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 $entity
  • param 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 $entity
  • param $field
  • param array $params
  • return array

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 $obj
  • param 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 $entity
  • param array $params

统计信息

  • 总下载量: 9.12k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2016-10-20