PHPackages                             beotie/lib\_test - 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. beotie/lib\_test

ActiveLibrary[Testing &amp; Quality](/categories/testing)

beotie/lib\_test
================

This package provide a set of class and traits to be used in test cases

09PHP

Since Feb 1Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Beotie/beotie-lib-test)[ Packagist](https://packagist.org/packages/beotie/lib_test)[ RSS](/packages/beotie-lib-test/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Beotie/lib\_test
================

[](#beotielib_test)

This library is used by Beotie project as base wrapper for some features. The first objective is to be abble to create tests in traits, rather than test case directly.

Implementing
------------

[](#implementing)

This library come with two traits, so it is enough to use these traits into your tests.

```
class MyTestCase extends TestCase
{
    use Beotie\LibTest\Traits\TestCaseTrait,
        MyFeatureTest;

    protected function getTestedInstance() : string
    {
        return MyAwesomeClass::class;
    }
}

trait MyFeatureTest
{
    use Beotie\LibTest\Traits\TestTrait;

    public function myTest()
    {
        $this->getTestCase()->assertTrue(true);
    }
}
```

The `Beotie\LibTest\Traits\TestCaseTrait` implement a `getTestCase()` method that return the current `TestCase` instance. It's needed to implement the `getTestedInstance()` method in order to be able to use the `Beotie\LibTest\Traits\TestTrait` as it define it abstract.

The `TestTrait` methods
-----------------------

[](#the-testtrait-methods)

### createEmptyInstance

[](#createemptyinstance)

In order to make unit testing with full abstraction, the `TestTrait` offer a `createEmptyInstance()` method that return a new instance of defined tested instance without calling constructor.

```
trait MyFeatureTest
{
    use Beotie\LibTest\Traits\TestTrait;

    public function myTest()
    {
        $instanceToTest = $this->createEmptyInstance();
        $this->getTestCase()->assertTrue($instanceToTest->isEmpty());
    }
}
```

### Property getter and setter

[](#property-getter-and-setter)

The `Beotie\LibTest\Traits\TestTrait` allow you to automatically extract and inject values into instance properties. It will follow the inheritance tree in order to find the property location if it is not hosted directly in the tested class and make it accessible if protected or private.

```
trait MyFeatureTest
{
    use Beotie\LibTest\Traits\TestTrait;

    public function myTest()
    {
        $instanceToTest = $this->createEmptyInstance();
        $this->setValue($instance, 'propertyName', 'valueToInject');
        $this->getTestCase()->assertFalse($instanceToTest->isEmpty());

        $instanceToTest->setPropertyName('otherValue');
        $this->getTestCase()->assertEquals('otherValue', $this->getValue($instance, 'propertyName'));
    }
}
```

### TestCase wrapping

[](#testcase-wrapping)

The `Beotie\LibTest\Traits\TestTrait` forward method invocation to the stored TestCase, so it's possible to directly call the `TestCase` methods inside the `TestTrait`.

```
trait MyFeatureTest
{
    use Beotie\LibTest\Traits\TestTrait;

    public function myTest()
    {
        $instanceToTest = $this->createEmptyInstance();
        $this->setValue($instance, 'propertyName', 'valueToInject');
        $this->assertFalse($instanceToTest->isEmpty());

        $instanceToTest->setPropertyName('otherValue');
        $this->assertEquals('otherValue', $this->getValue($instance, 'propertyName'));
    }
}
```

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

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://avatars.githubusercontent.com/u/12436206?v=4)[cscfa](/maintainers/cscfa)[@cscfa](https://github.com/cscfa)

---

Top Contributors

[![matthieu88160](https://avatars.githubusercontent.com/u/11874266?v=4)](https://github.com/matthieu88160 "matthieu88160 (2 commits)")

### Embed Badge

![Health badge](/badges/beotie-lib-test/health.svg)

```
[![Health](https://phpackages.com/badges/beotie-lib-test/health.svg)](https://phpackages.com/packages/beotie-lib-test)
```

###  Alternatives

[dms/phpunit-arraysubset-asserts

This package provides ArraySubset and related asserts once deprecated in PHPUnit 8

14228.7M341](/packages/dms-phpunit-arraysubset-asserts)[phpbenchmark/phpbenchmark

Easy to use benchmark toolkit for your PHP-application. This library contains classes for comparing algorithms as well as benchmarking application responses

8011.5k2](/packages/phpbenchmark-phpbenchmark)

PHPackages © 2026

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