a PHP library that emulates Python's with
statement
<?php
use function Contexts\with;
use Contexts\Context;
class TestContext implements Context
{
public function enter()
{
print("Before executing function\n");
}
public function quit($exception)
{
print("After executing function\n");
}
}
$context = new TestContext;
with($context, function() {
print("Executing function\n");
});
?>
phpunit tests