Download the PHP package ajant/db-mock-library without Composer
On this page you can find all versions of the php package ajant/db-mock-library. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ajant/db-mock-library
More information about ajant/db-mock-library
Files in ajant/db-mock-library
Package db-mock-library
Short Description Db mocking & dummy data management library
License MIT
Homepage https://github.com/ajant/DbMockLibrary
Informations about the package db-mock-library
DbMockLibrary
Db mocking & dummy data management library
This is a database stubbing/mocking/prototyping library. Its principal uses are meant to be:
-
testing the application without using actual database (by mocking data persistence layer, using DbMockLibrary)
-
quick prototyping, while delaying the writing of any database specific code (again by mocking data persistence layer, using DbMockLibrary)
- dummy data management during development phase
Description:
-
If data persistence code is kept separate from business logic code, in a different layer of the application, then data persistence layer can be mocked using DbMockLibrary during testing. That way objects that call on data persistence layer can be tested, without actually using a real database. As a result tests are faster and better code & test separation is achieved. DbMockLibrary could be used to mock data persistence layer functionality in the testing environment
-
When project is in prototyping stage, often making choice on database is not necessarily needed at that time. Sometimes it's even beneficial to postpone the decision for a while during that phase, until some features/architectural solutions take shape. What is needed is to have some "dummy data" available, to test out features and concepts with it. DbMockLibrary provides feature rich "dummy data" platform.
- During development, it's often convenient to have some easy way to load/remove "dummy data" from the database, in order to be able to test out features, without having to create dumps from the production database. DbMockLibrary provides a simple way to manage this process for some of the most popular databases
Requirements
You'll need: PHP version 5.4+
Installation
Install the latest version with composer:
Auto-load the library:
As of now MySQL, MongoDb and Elasticsearch databases have been implemented.
Quick start
Here's the example, how to use the library for testing DB features of the application.
MySQL
Bootstrapping:
Test set up:
Test tear down:
Elasticsearch
Note:
It is presumed that all indexes and mappings for records that are to be used in testing are already in Elasticsearch database.
Bootstrapping:
Test set up features:
Test tear down features:
All versions of db-mock-library with dependencies
ajant/simple-array-library Version >=2
elasticsearch/elasticsearch Version ~2.0