PHPackages                             lixu/behat-pdo-extension - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. lixu/behat-pdo-extension

ActiveBehat-extension[Testing &amp; Quality](/categories/testing)

lixu/behat-pdo-extension
========================

A simple PDO extension for behat.

17PHP

Since Jan 1Pushed 9y ago1 watchersCompare

[ Source](https://github.com/xu-li/behat-pdo-extension)[ Packagist](https://packagist.org/packages/lixu/behat-pdo-extension)[ RSS](/packages/lixu-behat-pdo-extension/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

This is a simple PDO extension for [behat](http://behat.org).

Install
=======

[](#install)

```
composer require behat/behat lixu/behat-pdo-extension --dev
```

behat.yml
=========

[](#behatyml)

Add following configuration items to your `behat.yml`.

```
default:
  suites:
    default:
      path: %paths.base%/features
      contexts:
        - FeatureContext
        - lixu\BehatPDOExtension\Context\PDOContext
  extensions:
    lixu\BehatPDOExtension:
      dsn: 'mysql:host=127.0.0.1;dbname=test;charset=UTF8'
      username: 'root'
      password: ''
```

Write a scenario
================

[](#write-a-scenario)

Here is a simple scenario:

Note: You have to implement the "When I eat one apple" step by yourself.

```
  Scenario: Buy a product
    Given there are following "fruits":
      | name   | stock_level |
      | apple  | 10          |
      | orange | 5           |

    When I eat one apple

    Then there should be following "fruits":
      | name   | stock_level |
      | apple  | 9           |
      | orange | 5           |

```

Use PDO in your feature class
=============================

[](#use-pdo-in-your-feature-class)

If you want to use `PDO` in your feature class, you can simply extend your feature class from `lixu\BehatPDOExtension\Context\PDOContext`, and get the PDO instance by `$this->getPDO()`.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/fbf9ec5ccab9e9cfa2579d0dd4007637fa881efde5e1b0d2e3e938900134276b?d=identicon)[xu-li](/maintainers/xu-li)

---

Top Contributors

[![xu-li](https://avatars.githubusercontent.com/u/171665?v=4)](https://github.com/xu-li "xu-li (1 commits)")

### Embed Badge

![Health badge](/badges/lixu-behat-pdo-extension/health.svg)

```
[![Health](https://phpackages.com/badges/lixu-behat-pdo-extension/health.svg)](https://phpackages.com/packages/lixu-behat-pdo-extension)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M678](/packages/phpspec-prophecy)[vimeo/psalm

A static analysis tool for finding errors in PHP applications

5.8k77.5M6.7k](/packages/vimeo-psalm)[brianium/paratest

Parallel testing for PHP

2.5k118.8M753](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M571](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.0k](/packages/orchestra-testbench)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
