2017 © Pedro Peláez
 

library mongounit

PHPUnit extension that supports mongodb

image

zumba/mongounit

PHPUnit extension that supports mongodb

  • Wednesday, July 25, 2018
  • by jrbasso
  • Repository
  • 8 Watchers
  • 32 Stars
  • 59,168 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 11 Forks
  • 0 Open issues
  • 14 Versions
  • 3 % Grown

The README.md

Mongounit is a PHPUnit extension for test cases that utilize MongoDB as their data source., (*1)

Latest Stable Version Build Status, (*2)

Requirements

  • PHP 5.6+
  • PHPUnit 4.0+
  • PECL mongodb 1.2+

Testing

  1. Install dependencies composer install -dev
  2. Run ./bin/phpunit

Example use

<?php

class MyMongoTestCase extends \PHPUnit_Framework_TestCase {
    use \Zumba\PHPUnit\Extensions\Mongo\TestTrait;

    /**
     * Get the mongo connection for this test.
     *
     * @return Zumba\PHPUnit\Extensions\Mongo\Client\Connector
     */
    public function getMongoConnection() {
        // Add your credentials here
        return new \MongoDB\Client();
    }

    /**
     * Get the dataset to be used for this test.
     *
     * @return Zumba\PHPUnit\Extensions\Mongo\DataSet\DataSet
     */
    public function getMongoDataSet() {
        $dataset = new \Zumba\PHPUnit\Extensions\Mongo\DataSet\DataSet($this->getMongoConnection());
        $dataset->setFixture([
            'some_collection' => [
                ['name' => 'Document 1'],
                ['name' => 'Document 2']
            ]
        ]);
        return $dataset;
    }

    public function testRead() {
        $result = $this->getMongoConnection()->test->some_collection->findOne(['name' => 'Document 2']);
        $this->assertEquals('Document 2', $result['name']);
    }

}

See full working example., (*3)

Note about PHP Versions

PHP 5.5 and below are no longer actively supported. If you are using these version, stick with previous versions of mongounit, however it is recommended to stop using these versions of PHP., (*4)

The Versions

25/07 2018

dev-master

9999999-dev https://github.com/zumba/mongounit

PHPUnit extension that supports mongodb

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb database testing mongoclient

25/07 2018

3.0.4

3.0.4.0 https://github.com/zumba/mongounit

PHPUnit extension that supports mongodb

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb database testing mongoclient

25/07 2018

dev-REQ-9766-upgrade-mongodb

dev-REQ-9766-upgrade-mongodb https://github.com/zumba/mongounit

PHPUnit extension that supports mongodb

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb database testing mongoclient

05/01 2018

3.0.3

3.0.3.0 https://github.com/zumba/mongounit

PHPUnit extension that supports mongodb

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb database testing mongoclient

17/02 2017

3.0.2

3.0.2.0 https://github.com/zumba/mongounit

PHPUnit extension that supports mongodb

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb database testing mongoclient

15/02 2017

3.0.1

3.0.1.0 https://github.com/zumba/mongounit

PHPUnit extension that supports mongodb

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb database testing mongoclient

15/02 2017

3.0.0

3.0.0.0 https://github.com/zumba/mongounit

PHPUnit extension that supports mongodb

  Sources   Download

MIT

The Requires

 

The Development Requires

mongodb database testing mongoclient

21/05 2015

2.0.0

2.0.0.0 https://github.com/zumba/mongounit

PHPUnit extension that supports mongodb

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-mongo *

 

The Development Requires

mongodb database testing mongoclient

31/03 2014

1.2.0

1.2.0.0 https://github.com/zumba/mongounit

PHPUnit extension that supports mongodb

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-mongo *

 

The Development Requires

mongodb database testing mongoclient

29/10 2013

v1.1.3

1.1.3.0 https://github.com/zumba/mongounit

PHPUnit extension that supports mongodb

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-mongo *

 

The Development Requires

mongodb database testing mongoclient

20/09 2013

v1.1.2

1.1.2.0 https://github.com/zumba/mongounit

PHPUnit extension that supports mongodb

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-mongo *

 

The Development Requires

mongodb database testing mongoclient

20/09 2013

v1.1.1

1.1.1.0 https://github.com/zumba/mongounit

PHPUnit extension that supports mongodb

  Sources   Download

MIT

The Requires

  • php >=5.3.0
  • ext-mongo *

 

The Development Requires

mongodb database testing mongoclient

11/02 2013

v1.1

1.1.0.0 https://github.com/zumba/mongounit

PHPUnit extension that supports mongodb

  Sources   Download

MIT

The Requires

 

mongodb database testing mongoclient

10/02 2013

v1.0

1.0.0.0 https://github.com/zumba/mongounit

PHPUnit extension that supports mongodb

  Sources   Download

MIT

The Requires

 

mongodb database testing mongoclient