2017 © Pedro Peláez
 

library php-callable-spy

Spy library for testing php callables

image

marcelerz/php-callable-spy

Spy library for testing php callables

  • Thursday, July 24, 2014
  • by marcelerz
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 29 % Grown

The README.md

php-callable-spy

PHP Callable Spy, (*1)

Example:, (*2)

// Closure to be spied on
$fn = function ($a, $b) {
    return $a + $b;
};

// Replace closure with a spy
$fn = new \Callable\Spy($fn);

echo $fn(5, 3); // Output: 8 (through spy proxy)

// Gets last call made through spy proxy
$lastCall = $fn->getLastCall();

$timestamp = $lastCall->getDate();          // Timestamp of call
$stackTrace = $lastCall->getStackTrace();   // Full stack-trace of call

print_r($lastCall->getArgs());      // Output: [5, 3]
print_r($lastCall->getResult());    // Output: 8

For more examples, have a look in the examples folder above! Also, there are a lot more examples as tests in the test folder., (*3)

The Versions

24/07 2014

dev-master

9999999-dev https://github.com/marcelerz/php-callable-spy

Spy library for testing php callables

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Marcel Erz

testing xunit spy

24/07 2014

1.0.0

1.0.0.0 https://github.com/marcelerz/php-callable-spy

Spy library for testing php callables

  Sources   Download

MIT

The Requires

  • php >=5.3.3

 

The Development Requires

by Marcel Erz

testing xunit spy