phpspec/phpspec2 — pull request #95 by mathiasverraes (2013-01-08 11:56:17+00:00)
Title: [WIP] Static construction of objects

As discussed in #79.

The code is just a POC and there are no specs yet. I figured I'd first try to get it working before diving in too deep.

This fixes my use case where I want to instantiate an object without using it's constructor directly.

Simplified example:

```
class Payment
{
private $amount;
private function __construct($amount)
{
$this->amount = $amount;
}

public static function create($amount)
{
return new static($amount);
}
}
```

In production code, you'd instantiate the Payment like this:

```
$payment = Payment::create(500);
```

In phpspec:

```
$this->beCreatedStaticallyWith(array('Invoice', 'create'), array($amount));
```