Nelmio\Alice\Definition\MethodCall\OptionalMethodCallTest::testCanCreateANewInstanceWithNoArguments PHP Method

testCanCreateANewInstanceWithNoArguments() public method

    public function testCanCreateANewInstanceWithNoArguments()
    {
        $arguments = [new \stdClass()];
        $methodCall = new SimpleMethodCall('getUsername', $arguments);
        $definition = new OptionalMethodCall($methodCall, new OptionalFlag(30));
        $newArguments = null;
        $newDefinition = $definition->withArguments($newArguments);
        $this->assertInstanceOf(OptionalMethodCall::class, $newDefinition);
        $this->assertEquals($methodCall->getCaller(), $definition->getCaller());
        $this->assertEquals(30, $definition->getPercentage());
        $this->assertEquals($methodCall->getMethod(), $definition->getMethod());
        $this->assertEquals($methodCall->getArguments(), $definition->getArguments());
        $this->assertEquals($methodCall->getCaller(), $newDefinition->getCaller());
        $this->assertEquals(30, $newDefinition->getPercentage());
        $this->assertEquals($methodCall->getMethod(), $newDefinition->getMethod());
        $this->assertEquals($newArguments, $newDefinition->getArguments());
    }