Skip to content
This repository has been archived by the owner on Oct 3, 2021. It is now read-only.

An example of how to mock global functions like print_r

License

Notifications You must be signed in to change notification settings

mkasberg/php_function_mock_example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Function Mocks

Build Status

Codeship Status

A simple example of how to mock global functions in PHP.

Notice how HelloPrinter.php uses the print_r function. Then, notice how we override that function in our unit test class. This works because we are in a namespace (that is not root, so we're not actually replacing print_r).

Running

Run it like this:

phpunit test/HelloPrinterTest.php

About

An example of how to mock global functions like print_r

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages