Skip to content

1.3

Compare
Choose a tag to compare
@xepozz xepozz released this 24 Feb 09:03
· 28 commits to main since this release
cb92342

What's Changed

Added tracing for mocked functions calls.

namespace Xepozz\InternalMocker\Tests\Integration;

final class UseInSucceedDataProviderStub
{
    public function run(string $value): string
    {
        return serialize($value);
    }
}
$object = new UseInSucceedDataProviderStub();
$object->run('test');
$object->run('test2');
$object->run('test3');

$traces = MockerState::getTraces(
    __NAMESPACE__,
    'serialize',
);

$traces will contain an array of arrays with the following structure:

[
    [
        'arguments' => ['test'], 
        'trace' => [...], 
        'result' => "s:4:"test";", 
    ],
    [
        'arguments' => ['test2'], 
        'trace' => [...], 
        'result' => "s:5:"test2";",
    ],
    [
        'arguments' => ['test3'],
        'trace' => [...],
        'result' => "s:5:"test3";",
    ],
]

Full Changelog: 1.2...1.3