blainesch/magicoracle
Composer 安装命令:
composer require --dev blainesch/magicoracle
包简介
A proxy class developed for unit testing that makes all methods and properties public to you.
README 文档
README
A proxy class developed for unit testing that makes all methods and properties public to you.
Basic Example
<?php // Library include('../magicOracle/src/Oracle.php'); // Namespace use magicOracle\src\Oracle as Oracle; // Mock Class class Foo { public $publicProperty; private $privateProperty; protected $protectedProperty; public function __construct() { $this->publicProperty = 'foo'; $this->privateProperty = 'bar'; $this->protectedProperty = 'baz'; } public function publicMethod($words) { return $words; } private function privateMethod() { return $this->publicProperty; } } // new class $fooBar = new Oracle('Foo'); // Call private method echo $fooBar->privateMethod(); // 'foo'; // Echo protected variable echo $fooBar->protectedProperty; // 'baz'; // Set and echo protected variable echo $fooBar->privateProperty; // 'bar'; $fooBar->privateProperty = 'BlaineSch'; echo $fooBar->privateProperty; // BlaineSch
Constructing Oracle
With class name
$fooBar = new Oracle('Foo');
With class name and args
$fooBar = new Oracle('Foo', array('arg1', 'arg2'));
With object
$foo = new Foo('arg1', 'arg2'); $fooBar = new Oracle($foo);
Requirements
Contributing
Requirements
Unit Testing
cd magicOracle
phpunit ./
PHPUnit 3.6.12 by Sebastian Bergmann.
Configuration read from /Users/blaineschmeisser/Sites/devup/magicOracle/phpunit.xml
......
Time: 0 seconds, Memory: 5.00Mb
OK (6 tests, 9 assertions)
统计信息
- 总下载量: 18
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-08-24