2017 © Pedro Peláez
 

library magicoracle

A proxy class developed for unit testing that makes all methods and properties public to you.

image

blainesch/magicoracle

A proxy class developed for unit testing that makes all methods and properties public to you.

  • Saturday, August 25, 2012
  • by BlaineSch
  • Repository
  • 1 Watchers
  • 1 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

magicOracle

A proxy class developed for unit testing that makes all methods and properties public to you., (*1)

Build Status, (*2)

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, (*3)

$fooBar = new Oracle('Foo');

With class name and args, (*4)

$fooBar = new Oracle('Foo', array('arg1', 'arg2'));

With object, (*5)

$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)

The Versions

25/08 2012

dev-master

9999999-dev https://github.com/BlaineSch/magicOracle

A proxy class developed for unit testing that makes all methods and properties public to you.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

phpunit testing proxy unit

25/08 2012

v1.0.0

1.0.0.0 https://github.com/BlaineSch/magicOracle

A proxy class developed for unit testing that makes all methods and properties public to you.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

phpunit testing proxy unit