function testDoNotStubPrivateMethods() { try { $foo = new Mockster(StubMethodsTest_FooClass::class); /** @noinspection PhpUndefinedMethodInspection */ Mockster::stub($foo->privateMethod()); $this->fail("Should have thrown an exception"); } catch (\ReflectionException $e) { $this->assert->contains($e->getMessage(), 'private methods'); $this->assert->contains($e->getMessage(), 'FooClass::privateMethod'); } }