PHPackages                             beyondit/opencart-test-suite - 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. beyondit/opencart-test-suite

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

beyondit/opencart-test-suite
============================

Testing Suite for OpenCart Development

3.0.0(8y ago)6821.3k↓100%36[2 issues](https://github.com/beyondit/opencart-test-suite/issues)1GPL-3.0PHPPHP &gt;=5.4

Since Apr 10Pushed 8y ago16 watchersCompare

[ Source](https://github.com/beyondit/opencart-test-suite)[ Packagist](https://packagist.org/packages/beyondit/opencart-test-suite)[ RSS](/packages/beyondit-opencart-test-suite/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (17)Used By (1)

[![Build Status](https://camo.githubusercontent.com/7c860e5df7c19cc327749b6f341223bff922ce4913b4451b0966c87dc911dc91/68747470733a2f2f7472617669732d63692e6f72672f6265796f6e6469742f6f70656e636172742d746573742d73756974652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/beyondit/opencart-test-suite)

OpenCart Testing Suite
======================

[](#opencart-testing-suite)

Supported OpenCart Versions
---------------------------

[](#supported-opencart-versions)

OpenCart versionopencart-test-suite versionbuild status~3.0~3.0[![Build Status](https://camo.githubusercontent.com/1dc779116729e6ea6b6dce9828e4a2b23eba39c137cc42f43c8a890e5e91a982/68747470733a2f2f7472617669732d63692e6f72672f6265796f6e6469742f6f70656e636172742d746573742d73756974652e7376673f6272616e63683d332e30)](https://travis-ci.org/beyondit/opencart-test-suite)~2.2.0~2.2.0[![Build Status](https://camo.githubusercontent.com/94b049dfd4753a775ff1a9491d5300e272a8c2f2d3d7276590c9597f80fb4fec/68747470733a2f2f7472617669732d63692e6f72672f6265796f6e6469742f6f70656e636172742d746573742d73756974652e7376673f6272616e63683d322e32)](https://travis-ci.org/beyondit/opencart-test-suite)~2.3.0~2.3.0[![Build Status](https://camo.githubusercontent.com/0af0c563cb263129fee9e97bd61ea570db15c4ba7e8acb9fa27c87875e75b2f8/68747470733a2f2f7472617669732d63692e6f72672f6265796f6e6469742f6f70656e636172742d746573742d73756974652e7376673f6272616e63683d322e33)](https://travis-ci.org/beyondit/opencart-test-suite)Motivation
----------

[](#motivation)

The intend of this project is to provide a simple approach for setting up a test suite for custom OpenCart development.

Getting started from scratch
----------------------------

[](#getting-started-from-scratch)

- Create a new OpenCart instance (maybe follow this [guide](https://medium.com/@stefan.huber/installing-opencart-with-composer-74fe0ba121b1))
- Add `opencart-test-suite` as a dependency `composer require beyondit/opencart-test-suite --dev`
- Use `composer require beyondit/opencart-test-suite:3.0 --dev` for OpenCart version 3.0 respectively
- Create a `tests` folder and add respective tests (see examples below)
- Add a `phpunit.xml` which includes testsuites (e.g. admin and catalog) and set an env variable to the opencart root directory (see example phpunit.xml below)
- Now tests can be run via `vendor/bin/phpunit --testsuite catalog-tests` command

**Our [OpenCart project template](https://github.com/beyondit/opencart-project-template) might simplify setup for you.**

Example of a phpunit.xml
------------------------

[](#example-of-a-phpunitxml)

```

            ./tests/catalog/

            ./tests/admin/

```

Test Examples
-------------

[](#test-examples)

### Testing a Model

[](#testing-a-model)

```
namespace Tests;

class ModelCatalogManufacturerTest extends OpenCartTest
{
    public function testASpecificManufacturer()
    {
        // load the manufacturer model
        $model = $this->loadModel("catalog/manufacturer");
        $manufacturer = $model->getManufacturer(5);

        // test a specific assertion
        $this->assertEquals('HTC', $manufacturer['name']);

    }
}
```

### Testing a Controller

[](#testing-a-controller)

```
namespace Tests;

class ControllerCheckoutCartTest extends OpenCartTest
{
    public function testAddingASpecificProductToTheCart()
    {
        $response = $this->dispatchAction('checkout/cart/add','POST',['product_id' => 28]);
        $output = json_decode($response->getOutput(),true);

        $this->assertTrue(isset($output['success']) && isset($output['total']));
        $this->assertRegExp('/HTC Touch HD/', $output['success']);
    }
}
```

### Testing with logged in Customers

[](#testing-with-logged-in-customers)

```
class ControllerAccountEditTest extends OpenCartTest {
    public function testEditAccountWithLoggedInCustomer() {

        $this->login('somebody@test.com','password');

        $response = $this->dispatchAction('account/edit');
        $this->assertRegExp('/Your Personal Details/',$response->getOutput());

        $this->logout();

    }
}
```

### Testing with logged in Users inside Admin

[](#testing-with-logged-in-users-inside-admin)

In order to test classes inside the admin folder just call your test class ending with `AdminTest` e.g. `ModelCatalogCategoryAdminTest`

```
class ControllerCommonDashboardAdminTest extends OpenCartTest {
    public function testShowDashboardWithLoggedInUser() {

        $this->login('admin','admin');

        $response = $this->dispatchAction('common/dashboard');
        $this->assertRegExp('/Total Sales/', $response->getOutput());

        $this->logout();

    }
}
```

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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.

###  Release Activity

Cadence

Every ~104 days

Recently: every ~58 days

Total

16

Last Release

3213d ago

Major Versions

0.3.3 → 2.2.02016-12-02

2.3.x-dev → 3.0.02017-07-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/0040de3600017ad8e45ec4d6f5c0d0e395277d9ace8a05ebfac11805a3816c60?d=identicon)[openmandragora](/maintainers/openmandragora)

---

Top Contributors

[![stefanhuber](https://avatars.githubusercontent.com/u/5379359?v=4)](https://github.com/stefanhuber "stefanhuber (27 commits)")[![openmandragora](https://avatars.githubusercontent.com/u/1311722?v=4)](https://github.com/openmandragora "openmandragora (21 commits)")[![vitormattos](https://avatars.githubusercontent.com/u/1079143?v=4)](https://github.com/vitormattos "vitormattos (17 commits)")[![beinoriusju](https://avatars.githubusercontent.com/u/24639014?v=4)](https://github.com/beinoriusju "beinoriusju (1 commits)")

---

Tags

opencartopencart-developmentphpunittestingphpunitopencart

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/beyondit-opencart-test-suite/health.svg)

```
[![Health](https://phpackages.com/badges/beyondit-opencart-test-suite/health.svg)](https://phpackages.com/packages/beyondit-opencart-test-suite)
```

###  Alternatives

[brianium/paratest

Parallel testing for PHP

2.5k118.8M752](/packages/brianium-paratest)[johnkary/phpunit-speedtrap

Find and report on slow tests in your PHPUnit test suite

78137.2M121](/packages/johnkary-phpunit-speedtrap)[spatie/phpunit-snapshot-assertions

Snapshot testing with PHPUnit

69417.9M510](/packages/spatie-phpunit-snapshot-assertions)[phpspec/prophecy-phpunit

Integrating the Prophecy mocking library in PHPUnit test cases

19254.9M1.4k](/packages/phpspec-prophecy-phpunit)[yoast/phpunit-polyfills

Set of polyfills for changed PHPUnit functionality to allow for creating PHPUnit cross-version compatible tests

18338.5M832](/packages/yoast-phpunit-polyfills)[ergebnis/phpunit-slow-test-detector

Provides facilities for detecting slow tests in phpunit/phpunit.

1468.1M72](/packages/ergebnis-phpunit-slow-test-detector)

PHPackages © 2026

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