PHPackages                             klever/tutor - 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. klever/tutor

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

klever/tutor
============

PHPUnit Extensions to easily spec-test data models

v0.1.0-alpha(9y ago)024.0k1PHPPHP ^7.0|^5.5CI failing

Since Sep 13Pushed 6y ago1 watchersCompare

[ Source](https://github.com/tklever/tutor)[ Packagist](https://packagist.org/packages/klever/tutor)[ RSS](/packages/klever-tutor/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (2)Used By (1)

klever/tutor
============

[](#klevertutor)

Easily test accessor methods on your models by providing a spec in your test case.

[![Build Status](https://camo.githubusercontent.com/6f268f13daf465433b3c9eef71d06478fd12e2c20927c0a589b2c7f1bf3dcc94/68747470733a2f2f7472617669732d63692e6f72672f746b6c657665722f7475746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/tklever/tutor)

Installation
============

[](#installation)

```
composer require --dev klever/tutor
```

Usage
=====

[](#usage)

Extend `\Klever\Tutor\AccessMethod\AbstractTestCase` and provide a spec for your model.

Example
=======

[](#example)

[`\Klever\TutorTest\AccessMethod\AbstractTestCaseIntegrationTest`](test/TutorTest/AccessMethod/AbstractTestCaseIntegrationTest.php)

Configuration
=============

[](#configuration)

[`\Klever\Tutor\AccessMethod\TestConfiguration::fromArray`](src/Tutor/AccessMethod/TestConfiguration.php)

accessor\_name
--------------

[](#accessor_name)

Override for non-conventional getters.

### Sample Class

[](#sample-class)

```
class Model
{
    private $foo;

    public function getBar()
    {
        return $this->foo;
    }
}

```

### Sample Config

[](#sample-config)

```
class ModelTest extends \Klever\Tutor\AccessMethod\AbstractTestCase
{
    public function getClassAccessMethodTestConfiguration()
    {
        return [
            'accessors' => [
                'foo' => [
                    'accessor_name' => 'getBar',
                ],
            ],
        ];
    }
}

```

is\_state\_accessor
-------------------

[](#is_state_accessor)

Use an `is` accessor instead of a `get` accessor.

### Sample Class

[](#sample-class-1)

```
class Model
{
    private $foo = true;

    public function isFoo()
    {
        return $this->foo;
    }
}

```

### Sample Config

[](#sample-config-1)

```
class ModelTest extends \Klever\Tutor\AccessMethod\AbstractTestCase
{
    public function getClassAccessMethodTestConfiguration()
    {
        return [
            'accessors' => [
                'foo' => [
                    'is_state_accessor' => true,
                ],
            ],
        ];
    }
}

```

default\_value
--------------

[](#default_value)

Default value of a property.

### Sample Class

[](#sample-class-2)

```
class Model
{
    private $foo = 'bar';

    public function getFoo()
    {
        return $this->foo;
    }
}

```

### Sample Config

[](#sample-config-2)

```
class ModelTest extends \Klever\Tutor\AccessMethod\AbstractTestCase
{
    public function getClassAccessMethodTestConfiguration()
    {
        return [
            'accessors' => [
                'foo' => [
                    'default_value' => 'bar',
                ],
            ],
        ];
    }
}

```

injectable\_value
-----------------

[](#injectable_value)

Value set into a property. This will be validated as the `expected_value` by default.

### Sample Class

[](#sample-class-3)

```
class Model
{
    private $foo;

    public function getFoo()
    {
        return $this->foo;
    }

    public function setFoo($foo)
    {
        $this->foo = $foo;
    }
}

```

### Sample Config

[](#sample-config-3)

```
class ModelTest extends \Klever\Tutor\AccessMethod\AbstractTestCase
{
    public function getClassAccessMethodTestConfiguration()
    {
        return [
            'accessors' => [
                'foo' => [
                    'injectable_value' => 'bar',
                ],
            ],
        ];
    }
}

```

expected\_value
---------------

[](#expected_value)

Expected value of a property.

### Sample Class

[](#sample-class-4)

```
class Model
{
    private $foo;

    public function getFoo()
    {
        return $this->foo;
    }

    public function setFoo($foo)
    {
        $this->foo = $foo . 'bar';
    }
}

```

### Sample Config

[](#sample-config-4)

```
class ModelTest extends \Klever\Tutor\AccessMethod\AbstractTestCase
{
    public function getClassAccessMethodTestConfiguration()
    {
        return [
            'accessors' => [
                'foo' => [
                    'injectable_value' => 'foo',
                    'expected_value' => 'foobar',
                ],
            ],
        ];
    }
}

```

injection\_method\_fluent
-------------------------

[](#injection_method_fluent)

Validates that the setter returns the model.

### Sample Class

[](#sample-class-5)

```
class Model
{
    private $foo;

    public function setFoo($foo)
    {
        $this->foo = $foo;
        return $this;
    }
}

```

### Sample Config

[](#sample-config-5)

```
class ModelTest extends \Klever\Tutor\AccessMethod\AbstractTestCase
{
    public function getClassAccessMethodTestConfiguration()
    {
        return [
            'accessors' => [
                'foo' => [
                    'injectable_value' => 'foo',
                    'injection_method_fluent' => true,
                ],
            ],
        ];
    }
}

```

injector\_name
--------------

[](#injector_name)

Override for non-conventional setters.

### Sample Class

[](#sample-class-6)

```
class Model
{
    private $foo;

    public function setBar($bar)
    {
        $this->foo = $bar;
    }
}

```

### Sample Config

[](#sample-config-6)

```
class ModelTest extends \Klever\Tutor\AccessMethod\AbstractTestCase
{
    public function getClassAccessMethodTestConfiguration()
    {
        return [
            'accessors' => [
                'foo' => [
                    'injectable_value' => 'foo',
                    'injector_name' => 'setBar',
                ],
            ],
        ];
    }
}

```

Dependencies
============

[](#dependencies)

See [composer.json](composer.json).

Contributing
------------

[](#contributing)

```
git clone git@github.com:tklever/tutor.git && cd tutor
composer update && vendor/bin/phing
```

This library attempts to comply with [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md), and [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md). If you notice compliance oversights, please send a patch via pull request.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 61.5% 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3535d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1104e04ccb26d61a408d46e2b18f39fa3cea9cc11a588e8d1ca2a7103c44c88b?d=identicon)[tklever](/maintainers/tklever)

---

Top Contributors

[![tklever](https://avatars.githubusercontent.com/u/1569850?v=4)](https://github.com/tklever "tklever (8 commits)")[![abacaphiliac](https://avatars.githubusercontent.com/u/1656273?v=4)](https://github.com/abacaphiliac "abacaphiliac (5 commits)")

###  Code Quality

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/klever-tutor/health.svg)

```
[![Health](https://phpackages.com/badges/klever-tutor/health.svg)](https://phpackages.com/packages/klever-tutor)
```

###  Alternatives

[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[timacdonald/log-fake

A drop in fake logger for testing with the Laravel framework.

4235.9M56](/packages/timacdonald-log-fake)[jasonmccreary/laravel-test-assertions

A set of helpful assertions when testing Laravel applications.

3513.9M32](/packages/jasonmccreary-laravel-test-assertions)[ergebnis/phpunit-slow-test-detector

Provides facilities for detecting slow tests in phpunit/phpunit.

1468.1M72](/packages/ergebnis-phpunit-slow-test-detector)[typo3/testing-framework

The TYPO3 testing framework provides base classes for unit, functional and acceptance testing.

675.0M775](/packages/typo3-testing-framework)[robiningelbrecht/phpunit-pretty-print

Prettify PHPUnit output

76460.0k15](/packages/robiningelbrecht-phpunit-pretty-print)

PHPackages © 2026

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