Skip to content

Latest commit

 

History

History
62 lines (44 loc) · 2.19 KB

CONTRIBUTING.md

File metadata and controls

62 lines (44 loc) · 2.19 KB

Contributing to the PHP Driver for MongoDB

Building from VCS (GitHub)

Developers who would like to contribute to the driver will need to build it from VCS like so:

$ git clone https://github.com/mongodb/mongo-php-driver.git phongo
$ cd phongo
$ git submodule update --init
$ phpize
$ ./configure --enable-developer-flags
$ make -j8 all

Testing

The test suites expects to find PHONGO-SERVERS.json in the system temp directory (typically /tmp). This file should contain JSON object with MONGODB URIs, similar to the following template

{
    "STANDALONE": "mongodb:\/\/192.168.112.10:2000",
    "STANDALONE_SSL": "mongodb:\/\/192.168.112.10:2100",
    "STANDALONE_AUTH": "mongodb:\/\/root:toor@192.168.112.10:2200\/?authSource=admin",
    "STANDALONE_X509": "mongodb:\/\/C=US,ST=New York,L=New York City,O=MongoDB,OU=KernelUser,CN=client@192.168.112.10:2300\/?authSource=$external&authMechanism=MONGODB-X509",
    "STANDALONE_PLAIN": "mongodb:\/\/root:toor@192.168.112.10:2400\/?authSource=admin",
    "REPLICASET": "mongodb:\/\/192.168.112.10:3000,192.168.112.10:3001,192.168.112.10:3002\/?replicaSet=REPLICASET"
}

The location of this PHONGO-SERVERS.json file can be configured by exporting PHONGO_SERVERS environment variable with a absolute path to the json configuration file.

Alternatively, we provide, and use, Vagrant to spin up handful of VMs where we setup and configure MongoDB according to our needs. This is the preferred way of creating PHONGO-SERVERS.json and running the test suite.

$ make vm # requires vagrant (www.vagrantup.com)
$ make test-bootstrap # Spins up mongod's in the virtual machines

The test-bootstrap make target will then generate the required PHONGO-SERVERS.json.

To execute the test suite:

$ make test # Executes the test suite against the virtual machines

The bundled Vagrantfile also contains few other (growing) list of VMs that can be provisioned to execute the test suite on various platforms.

These are automatically executed by the make distcheck, which will package a new PECL archive, spin up the various operating systems, install the newly packaged archive, and execute the test suite.