Phake

Synopsis

Phake is a mocking framework for PHP. It allows for the creation of objects that mimic a real object in a predictable and controlled manner. This allows you to treat external method calls made by your system under test (SUT) as just another form of input to your SUT and output from your SUT. This is done by stubbing methods that supply indirect input into your test and by verifying parameters to methods that receive indirect output from your test.

Help Command

This command helps to determine the usage of Phake module. The user will come to know about the different ways/format to execute this module. This command guides the end user to know the purpose of this command. Below given are the command and the screenshot of the same.

               cleopatra Phake help


kevells@corp:/# cleopatra Phake help
******************************


 This command allows you to install or update Phake.

 Phake, phake

       - install
       Installs the latest version of phake
       example: cleopatra phake install

       - ensure
       Installs the latest version of phake, only if a version is not installed
       example: cleopatra phake ensure

------------------------------
End Help
******************************

Installation

When the user needs to install Phake in machine, the below given command will execute the process of installation.

cleopatra Phake install

The system ask for the directory name, if you wants to set up your PATH you can define your path. Define your path followed by ‘/’ symbol. Press Enter if there is no changes to be done.

“What is the program data directory? Found “/opt/phake” - use this?

Then the system ask for executing directory name, if you wants to set up your PATH you can define your path. Define your path followed by ‘/’ symbol. Press Enter if there is no changes to be done

“What is the program executer directory? Found “/usr/bin” - Use this? “

The below screenshot shows the same.

kevells@corp:/# cleopatra Phake install Install Phake ? (Y/N) Y *************************** * Pharaoh Tools * * Phake * *************************** What is the program data directory? Found “/opt/phake” - use this? (Enter nothing for yes, no end slash)

What is the program executor directory? Found “/usr/bin” - use this? (Enter nothing for yes, No Trailing Slash)

git clone ‘http://github.com/jaz303/phake.git‘ /tmp/phake/phakeCloning into ‘/tmp/phake/phake’... remote: Counting objects: 552, done. remote: Total 552 (delta 0), reused 0 (delta 0) Receiving objects: 100% (552/552), 91.36 KiB | 76.00 KiB/s, done. Resolving deltas: 100% (314/314), done. Checking connectivity... done. Program Data folder populated Program Executor Deleted if existed ... All done! *************************** Thanks for installing , visit www.pharaohtools.com for more **************************

Options

Parameters Alternative Parameter Options Comments
Cleopatra Phake Install Either of the two alternative parameter can be used in command- Phake, phake eg: Cleopatra phake Install Y Once the user provides the option, System starts installation process
Cleopatra Phake Install Either of the two alternative parameter can be used in command- Phake, phake eg: Cleopatra phake Install| N Once the user provides the option, System stops installation process

Ensure

Installs the latest version of Phake, only if a version is not available. The below given command will execute the process.

Cleapatra Phake ensure

The system ask for the directory name, define your path followed by ‘/’ symbol. Press Enter if there is no changes to be done.

“What is the program data directory? Found “/opt/phake” - use this?

Then the system ask for executing directory name, define your path followed by ‘/’ symbol. Press Enter if there is no changes to be done

“What is the program executer directory? Found “/usr/bin” - Use this? “

Benefits

Phake is a great mocking library and can be easily integrated into PHPUnit. Its new approach to prototype mocks and stubs and the separation between stubbing and verification phases is very refreshing and easy to use.

comments powered by Disqus

Edit this document!

This file can be edited directly through the Web. Anyone can update and fix errors in this document with few clicks -- no downloads needed.

  1. Go to Phake on GitHub.
  2. Edit files using GitHub's text editor in your web browser (see the 'Edit' tab on the top right of the file)
  3. Fill in the Commit message text box at the bottom of the page describing why you made the changes. Press the Propose file change button next to it when done.
  4. Then click Send a pull request.
  5. Your changes are now queued for review under the project's Pull requests tab on GitHub!

For an introduction to the documentation format please see the reST primer.