Skip to content

Instantly share code, notes, and snippets.

@mwr
Last active February 4, 2016 09:00
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 mwr/843e0a86becbb5412dc5 to your computer and use it in GitHub Desktop.
Save mwr/843e0a86becbb5412dc5 to your computer and use it in GitHub Desktop.
PHPUnit Parameter Validation using Callback (phpunit 4.1.0)
<?php
// Validation Callback
$validator1 = new \PHPUnit_Framework_Constraint_Callback(
function (/** @todo add parameter **/) {
// @todo add assertions here
return true;
}
);
$validator2 = new \PHPUnit_Framework_Constraint_Callback(
function (/** @todo add parameter **/) {
// @todo add assertions here
return true;
}
);
//
$this->mock->expects($this->once())->method('$METHODNAME')->with($validator1, $validator2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment