SHARE
TWEET

Mocking function call with PHPUnit

a guest Sep 29th, 2012 48 Never
  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. }
RAW Paste Data
Top