public function setUp() { //This mock fingerprints strings that do not start with a "x" prefixing them with a "notx:" string $this->valueFingerPrinter = $this->getMock('Finga\\FingerPrinter\\FingerPrinterInterface'); $this->valueFingerPrinter->expects($this->any())->method('isFingerprintable')->will($this->returnCallback(function ($value) { return is_string($value) && $value[0] != 'x'; })); $this->valueFingerPrinter->expects($this->any())->method('fingerPrint')->will($this->returnCallback(function ($value) { return 'notx:' . $value; })); $this->keyFingerPrinter = $this->valueFingerPrinter; $this->fingerPrinter = new RecursiveFingerPrinter($this->valueFingerPrinter, $this->keyFingerPrinter); }
public function setUp() { $this->fingerPrinterMock = $this->getMockBuilder('Finga\\FingerPrinter\\FingerPrinterInterface')->getMock(); //This mock fingerprinter accepts only strings and prefix them with a "xxx:" string. $this->fingerPrinterMock->expects($this->any())->method('isFingerprintable')->will($this->returnCallback(function ($value) { return is_string($value); })); $this->fingerPrinterMock->expects($this->any())->method('fingerPrint')->will($this->returnCallback(function ($value) { return 'xxx:' . $value; })); //This mock for the transformationFingerPrinter class transform each value to the string //"transform" $this->trFingerPrinterMock = $this->getMockBuilder('Finga\\FingerPrinter\\TransformationFingerPrinter')->setConstructorArgs(array($this->fingerPrinterMock))->setMethods(array('getTransformation'))->getMock(); $this->trFingerPrinterMock->expects($this->any())->method('getTransformation')->will($this->returnValue(function () { return 'transformed'; })); }