Skip to content

Instantly share code, notes, and snippets.

@s7anley
Created August 17, 2016 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save s7anley/310520115bda3dc825307b94bf2dd954 to your computer and use it in GitHub Desktop.
Save s7anley/310520115bda3dc825307b94bf2dd954 to your computer and use it in GitHub Desktop.
withCallback
<?php
/**
* @dataProvider expressionsProvider
*/
public function testEvaluateReceiveCorrectExpression(Expression $expectedExpression)
{
$evaluator = $this->getMock(Evaluator::class);
$evaluator->expects($this->once())
->method('evaluate')
->with(
$this->callback(
function ($expression) use ($expectedExpression) {
// Has to return boolean
return ($expression->getType() === $expectedExpression->getType());
}
)
);
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment