Want more features on Pastebin? Sign Up, it's FREE!
Guest

Mocking function call with PHPUnit

By: a guest on Sep 29th, 2012  |  syntax: PHP  |  size: 0.29 KB  |  views: 48  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2. namespace Test;
  3.  
  4. function file_get_contents($file) {
  5.     return 'Foo Bar';
  6. }
  7.  
  8. class MockingAFunctionCall extends \PHPUnit_Framework_TestCase
  9. {
  10.     public function testIWillCallAMockFunction()
  11.     {
  12.         $this->assertEquals(file_get_contents('fool.txt'), 'Foo Bar');
  13.     }
  14. }
clone this paste RAW Paste Data