public function testIsInstantiable() { $class = $this->getMockBuilder('\\ReflectionClass')->setConstructorArgs(['\\Exception'])->getMock(); $class->expects($this->atLeastOnce())->method('isInstantiable')->will($this->returnValue(true)); $constructor = $this->getMockBuilder('\\ReflectionMethod')->setConstructorArgs(['\\Exception', '__construct'])->getMock(); $constructor->expects($this->atLeastOnce())->method('getNumberOfRequiredParameters')->will($this->returnValue(1)); $class->expects($this->atLeastOnce())->method('getConstructor')->will($this->returnValue($constructor)); $in = new Instantiator(); $in->setReflectionClass($class); $this->assertTrue($in->isInstantiable()); $this->assertFalse($in->isInstantiableWithoutArgs()); $this->setExpectedException('hanneskod\\classtools\\Exception\\LogicException'); $in->instantiate(); }