Memory¶
In order for these assertions to work properly you need to:
- add
declare(ticks = 1);
at the top of file where you call the assertion - the callable cannot use the anonymous function short notation
Example
blackbox.php
<?php
declare(strict_types = 1);
declare(ticks = 1);
require 'path/to/vendor/autoload.php';
use Innmind\BlackBox\{
Application,
Runner\Assert,
};
Application::new([])
->tryToProve(static function(): \Generator {
yield test(
'Some memory test',
static function(Assert $assert) {
$assert
->memory(static function() {
// your code here
})
->inLessThan()
->megaBytes(42);
},
);
})
->exit();