Skip to content

Instantly share code, notes, and snippets.

@trq
Last active August 29, 2015 14:13
Show Gist options
  • Save trq/d50fbe0254496136c82c to your computer and use it in GitHub Desktop.
Save trq/d50fbe0254496136c82c to your computer and use it in GitHub Desktop.
<?php
namespace Trq;
class Foo
{
protected function __construct()
{
}
public static function create()
{
return new static();
}
}
<?php
namespace spec\Trq;
use PhpSpec\ObjectBehavior;
use Prophecy\Argument;
class FooSpec extends ObjectBehavior
{
function it_is_initializable()
{
$this->beConstructedThrough('create');
$this->shouldHaveType('Trq\Foo');
}
}
Trq\Foo
10 ! is initializable
exception [exc:ReflectionException("Access to non-public constructor of class Trq\Foo")] has been thrown.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment