PHPackages                             jelito/devstack - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. jelito/devstack

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jelito/devstack
===============

v1.2.0(10y ago)0178PHPPHP &gt;=5.3.0

Since Jan 19Pushed 10y ago1 watchersCompare

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

READMEChangelog (3)DependenciesVersions (4)Used By (0)

Devstack
========

[](#devstack)

Validation
----------

[](#validation)

exceptions are from namespace \\Jelito\\DevStack\\Mocker\\Exception

- StaticMethodException - try to mock static method
- PrivateMethodException - try to mock private method
- ProtectedMethodException - try to mock protecket method
- NonExistentMethodException - try to mock unknown method
- FinalMethodException - try to mock final method
- UnknownVerifyMethodException - try to verify method which is not mocked
- UndeclaredMethodInvocationException - try to call method which is not mocked

Return values
-------------

[](#return-values)

#### Return value

[](#return-value)

```
// create mocker, $this is instance of PHPUnit_Framework_TestCase
$mocker = new Mocker('MockBuilderTestClass', $this);

// mock method
$mocker->mockMethod('sum')->willReturn(666);

// create mocked object
$mockedObject = $mocker->createMock();

// test it
$this->assertEquals(666, $mockedObject->sum(1, 2));
```

#### Throw exception

[](#throw-exception)

```
// create mocker, $this is instance of PHPUnit_Framework_TestCase
$mocker = new Mocker('MockBuilderTestClass', $this);

// mock method
$expectedException = new Exception('test');
$mocker->mockMethod('sum')->willThrow($expectedException);

// create mocked object
$mockedObject = $mocker->createMock();

// test it
try {
	$mockedObject->sum(1, 2);
} catch (Exception $actualException) {
	$this->assertSame($expectedException, $actualException);
}
```

#### Return self - return $this

[](#return-self---return-this)

```
// create mocker, $this is instance of PHPUnit_Framework_TestCase
$mocker = new Mocker('MockBuilderTestClass', $this);

// mock method
$mocker->mockMethod('sum')->willReturnSelf();

// create mocked object
$mockedObject = $mocker->createMock();

// test it
$this->assertSame($mockedObject, $mockedObject->sum(1));
```

#### Return argument - return param passed to function

[](#return-argument---return-param-passed-to-function)

```
// create mocker, $this is instance of PHPUnit_Framework_TestCase
$mocker = new Mocker('MockBuilderTestClass', $this);

// mock method
$mocker->mockMethod('sum')->willReturnArgument(1);

// create mocked object
$mockedObject = $mocker->createMock();

// test it
$this->assertEquals(1, $mockedObject->sum(1));
$this->assertEquals(2, $mockedObject->sum(2));
$this->assertEquals(3, $mockedObject->sum(3));
```

#### Call callback

[](#call-callback)

```
// create mocker, $this is instance of PHPUnit_Framework_TestCase
$mocker = new Mocker('MockBuilderTestClass', $this);

// mock method
$mocker->mockMethod('sum')->willCallback(function ($a, $b) {
	return $a * $b;
});

// create mocked object
$mockedObject = $mocker->createMock();

// test it
$this->assertEquals(2, $mockedObject->sum(1, 2));
$this->assertEquals(12, $mockedObject->sum(3, 4));
$this->assertEquals(30, $mockedObject->sum(5, 6));
```

Post assets
-----------

[](#post-assets)

#### Number of invocations

[](#number-of-invocations)

```
// create mocker, $this is instance of PHPUnit_Framework_TestCase
$mocker = new Mocker('MockBuilderTestClass', $this);

// mock method
$mocker->mockMethod('sum')->willReturn(666);

// create mocked object
$mockedObject = $mocker->createMock();

// test it
$mocker->verifyMethod('sum')->calledNever(); # method sum() was never called

$mockedObject->sum(1, 2);  # called first time
$mocker->verifyMethod('sum')->calledOnce();

$mockedObject->sum(3, 4);  # called second time
$mocker->verifyMethod('sum')->calledExactly(2);
```

#### Expected params of invocations

[](#expected-params-of-invocations)

```
// create mocker, $this is instance of PHPUnit_Framework_TestCase
$mocker = new Mocker('MockBuilderTestClass', $this);

// mock method
$mocker->mockMethod('sum')->willReturn(666);

// create mocked object
$mockedObject = $mocker->createMock();

// call it
$mockedObject->sum(1, 2);
$mockedObject->sum(3, 4);
$mockedObject->sum(5, 6);

// test it
$mocker->verifyMethod('sum')->invocationNo(1)->expectedParams(1, 2); # first call with params 1 and 2
$mocker->verifyMethod('sum')->invocationNo(2)->expectedParams(3, 4); # second call with params 3 and 4
$mocker->verifyMethod('sum')->invocationNo(3)->expectedParams(5, 6); # third call with params 5 and 6
$mocker->verifyMethod('sum')->invocationNo(-1)->expectedParams(5, 6); # last call with params 5 and 6
$mocker->verifyMethod('sum')->invocationNo(-2)->expectedParams(3, 4); # second call from end with params 3 and 4
$mocker->verifyMethod('sum')->invocationNo(-3)->expectedParams(1, 2); # third call from end with params 1 and 2
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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.

###  Release Activity

Cadence

Every ~102 days

Total

3

Last Release

3930d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/53bce69c04daa987540a84ff2784f5053b18e44700db079ca8c1508910357b55?d=identicon)[jelito](/maintainers/jelito)

---

Top Contributors

[![jan-hajek](https://avatars.githubusercontent.com/u/4404267?v=4)](https://github.com/jan-hajek "jan-hajek (31 commits)")

### Embed Badge

![Health badge](/badges/jelito-devstack/health.svg)

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

###  Alternatives

[flow-php/etl

PHP ETL - Extract Transform Load - Abstraction

374468.4k51](/packages/flow-php-etl)[sylius-labs/polyfill-symfony-security

Symfony Security Polyfill

135.9M6](/packages/sylius-labs-polyfill-symfony-security)

PHPackages © 2026

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