Download the PHP package jeffersongoncalves/pest-plugin-mysql-compat without Composer

On this page you can find all versions of the php package jeffersongoncalves/pest-plugin-mysql-compat. 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 pest-plugin-mysql-compat

Pest Plugin MySQL Compat

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Run a MySQL-flavored Laravel test suite against SQLite in memory without changing a single line of production SQL. The production query is the truth; the test database is what adapts.

A Laravel project with a legacy MySQL database usually runs its test suite on SQLite for speed and isolation. Every query that uses a MySQL-only function then dies in the test, and the usual fixes are all bad: rewriting the query to a SQLite-compatible subset (now the test covers SQL that isn't the production SQL), marking the test ->todo() (the business rule goes uncovered), or requiring a real MySQL for the suite (losing isolation and speed). This package installs the missing/divergent MySQL functions as SQLite user-defined functions (UDFs), with fidelity to NULL propagation, byte-length semantics, and legacy zero-dates — so the query itself never has to change.

Installation

You can install the package via composer:

Usage

Pest

This is shorthand for:

Alternative, without the Pest-specific helper — bind your own base TestCase instead:

PHPUnit / plain Laravel

MysqlCompat::install() must run before the app resolves its first database connection — it registers a connection resolver, and resolvers only affect connections created afterwards. That is why it is called before parent::setUp(), not after.

Granular configuration

Function catalog

Missing from SQLite — installed as UDFs

Function Signature Fidelity note
IF 3 args SQLite has native IIF; registering IF works
JSON_UNQUOTE 1 arg see below — not a blind identity
CONCAT variadic propagates NULL
SUBSTRING 2–3 args 1-indexed, like MySQL
DATE_FORMAT 2 args treats '0000-00-00' as NULL
LPAD 3 args
LEFT 2 args
RIGHT 2 args
SUBSTRING_INDEX 3 args negative count counts from the end
PERIOD_ADD 2 args returns the same type it received
LAST_DAY 1 arg
NOW 0 args

Native in SQLite, but with divergent semantics — overridden

Function SQLite native MySQL Action
LENGTH LENGTH('ção')3 (characters) 5 (bytes) overridden with strlen
ROUND ROUND(1234.5, -2)1235.0 1200 overridden for negative precision

LENGTH is the most treacherous divergence: on a column of digits (CPF, CNPJ, CEP) both agree and the test passes; on accented text they silently diverge.

JSON_EXTRACT was measured to diverge too (JSON_EXTRACT returns a bare scalar in SQLite, a quoted JSON value in MySQL) but is not overridden — JSON_UNQUOTE is adapted instead to strip the surrounding quotes only when they are present, so it works over either shape.

Known limitations

Roadmap

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email the author instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of pest-plugin-mysql-compat with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
spatie/laravel-package-tools Version ^1.16
laravel/framework Version ^12.61.1|^13.12.0
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 jeffersongoncalves/pest-plugin-mysql-compat contains the following files

Loading the files please wait ...