Download the PHP package jimbojsb/pseudo without Composer

On this page you can find all versions of the php package jimbojsb/pseudo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package pseudo

Pseudo

Pseudo is a system for mocking PHP's PDO database connections. When writing unit tests for PHP applications, one frequently has the need to test code that interacts with a database. However, in the true spirit of a unit test, the database should be abstracted, as we can assume with some degree of certainty that things like network links to the database server, the database connection drivers, and the database server and software itself are "going to work", and they are outside the scope of our unit tests.

Enter Pseudo. Pseudo allows you to have "fake" interactions with a database that produce predefined results every time. This has 2 main advantages over actually interacting with a database. First, it saves having to write data fixtures in another format, ensuring the data schema availability, loading the fixtures in, and then later cleaing and resetting them between tests. Second, and somewhat as a result of the first, tests can run significantly faster because they are essentially talking to an in-memory object structure rather than incurring all the overhead of connecting and interacting with an actual database.

Theory of Operation

The general idea is that Pseudo implements all of the classes in the PDO system by inheriting from them and then overriding their methods. During your test, at the point where you would inject a PDO object into your data layer, you can now inject a Pseudo\Pdo object transparently, giving yourself 100% flexibility to control what your application now thinks is the database. In your unit test, you can express the mocks for your test in terms of SQL statements and arrays of result data.

Simple Example

<?php
$p = new Pseudo\Pdo();
$results = [['id' => 1, 'foo' => 'bar']];
$p->mock("SELECT id FROM objects WHERE foo='bar'", $results);

// now use this $p object like you would any regular PDO
$results = $p->query("SELECT id FROM objects WHERE foo='bar'");
while ($result = $results->fetch(PDO::FETCH_ASSOC)) {
    echo $result["foo"];  // bar
}

Supported features

The internal storage of mocks and results are associatve arrays. Pseudo attempts to implement as much of the standard PDO feature set as possible, so varies different fetch modes, bindings, parameterized queries, etc all work as you'd expect them to.

Not implemented / wish-list items

Tests

Pseudo has a fairly robust test suite written with PHPUnit. If you'd like to run the tests, simply run ./vendor/bin/phpunit in the root folder. The tests have no external library dependencies (other than phpunit) and should require no additional setup or bootstrapping to run.

Pseudo is also tested on Travis-CI Build Status

Requirements

Pseudo internals currently target PHP 5.4.0 and above. It has no external dependencies aside from the PDO extension, which seems rather obvious.

Pseudo is built and tested with error reporting set to . If you are running in a stricter error reporting mode, your tests will most likely fail due to strict mode method signature violations. (This is on the known issues / to do list)


All versions of pseudo with dependencies

PHP Build Version
Package Version
No informations.
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package jimbojsb/pseudo contains the following files

Loading the files please wait ....