FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

rootworkit/phpunit-helpers: Helpers for PHPUnit · GitHub

Latest commit

 

History

15 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHPUnit Helpers

Helper traits for PHPUnit

"You can touch your privates and you can touch your friends' privates but you can't touch your parents' privates... unless they're protected." -Unknown

Installation

Install composer in a common location or in your project:

curl -s http://getcomposer.org/installer | php

Create the composer.json file as follows:

{
    "require": {
        "rootwork/phpunit-helpers": "dev-master"
    }
}

Run the composer installer:

php composer.phar install

Usage

namespace Test;

use Rootwork\PHPUnit\Helper\Accessor;

class MyTest extends \PHPUnit_Framework_TestCase
{
    use Accessor;

    public function testThings()
    {
        $sut = new MyThing();

        // Set a non-public property
        $this->setPropertyValue($sut, 'someNonPublicProperty', 'foo');

        // Get a non-public property
        $result = $this->getPropertyValue($sut, 'someNonPublicProperty'); // foo

        // Invoke a non-public method
        $this->invokeMethod($sut, 'someNonPublicMethod', ['foo', 'bar']);

        // Invoke a non-public method with arguments
        $this->invokeMethod($sut, 'someNonPublicMethod', ['foo', 'bar']);
    }
}

About

Helpers for PHPUnit

Resources

Stars

1 star

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages


Back | FazBrowse Home | New Git URL