Nelmio\Alice\IsAServiceTraitTest::testThrowsAnExceptionWhenTryingToCloneInstance PHP Method

testThrowsAnExceptionWhenTryingToCloneInstance() public method

    public function testThrowsAnExceptionWhenTryingToCloneInstance()
    {
        try {
            clone new NotClonableDummy();
            $this->fail('Expected exception to be thrown.');
        } catch (UnclonableException $exception) {
            $this->assertEquals('This class is a service and as such should not be cloned. A service is not necessarily stateless and as ' . 'such cloning it may result in weird side effects. You should either create a new instance or make use ' . 'of a static or non static factory instead.', $exception->getMessage());
            $this->assertEquals(0, $exception->getCode());
            $this->assertNull($exception->getPrevious());
        }
    }