AppserverIo\Appserver\Core\ServerNodeConfigurationTest::getServerNodeWithMockedConfiguration PHP Метод

getServerNodeWithMockedConfiguration() защищенный Метод

Creates a new server instance with a mocked configuration, that returns the param with the passed key/value.
protected getServerNodeWithMockedConfiguration ( mixed $value, string $key = null, string $methodName = 'getParam' ) : ServerNodeConfiguration
$value mixed The parameter value to return
$key string The parameter key to return
$methodName string The method name of the configuration we want to invoke
Результат ServerNodeConfiguration The server node instance to be tested
    protected function getServerNodeWithMockedConfiguration($value, $key = null, $methodName = 'getParam')
    {
        // create a mock configuration instance
        $mockNode = $this->getMock('AppserverIo\\Appserver\\Core\\Api\\Node\\ServerNode', array($methodName));
        $mockMethod = $mockNode->expects($this->once())->method($methodName)->will($this->returnValue($value));
        // check if we've a param
        if ($key != null) {
            $mockMethod->with($this->equalTo($key));
        }
        // initialize the server node
        return new ServerNodeConfiguration($mockNode);
    }