×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: Dmitriy Lanets
Added: Jul 13, 2015 9:33 PM
Views: 13
Tags: phpunit
  1. <?php
  2. class FooTest extends PHPUnit_Framework_TestCase
  3. {
  4.     /**
  5.      * @covers Foo::doSomethingPrivate
  6.      */
  7.     public function testPrivateMethod()
  8.     {
  9.         $method = new ReflectionMethod(
  10.           'Foo', 'doSomethingPrivate'
  11.         );
  12.  
  13.         $method->setAccessible(TRUE);
  14.  
  15.         $this->assertEquals(
  16.           'blah', $method->invoke(new Foo)
  17.         );
  18.     }
  19. }
  20. ?>