PHP code example of kambo / classopener
1. Go to this page and download the library: Download kambo/classopener library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
kambo / classopener example snippets
use Kambo\Testing\ClassOpener\PHPUnit\ClassOpenerTestCase;
class ClassOpenerTestCaseTest extends ClassOpenerTestCase
{
/**
* Disable final and mock the class
*
* @disableFinal Kambo\Tests\Testing\ClassOpener\Fixtures\Foo
*/
public function testAnnotationMocking()
{
// You can use your traditional mocking/stubing techniques
$fooMock = $this->getMockBuilder(Foo::class)
->disableOriginalConstructor()
->getMock();
$fooMock->method('bar')->will($this->returnValue(false));
$this->assertFalse($fooMock->bar());
}
}
use Kambo\Testing\ClassOpener\PHPUnit\ClassOpenerTestCase;
class ClassOpenerTestCaseTest extends ClassOpenerTestCase
{
/**
* Disable final and mock the class
*
* @runInSeparateProcess
* @disableFinal Kambo\Tests\Testing\ClassOpener\Fixtures\Foo
*/
public function testAnnotationMocking()
{