Coduo\TuTu\Config\Element::fromArray PHP Method

fromArray() public static method

public static fromArray ( array $arrayConfig ) : Element
$arrayConfig array
return Element
    public static function fromArray(array $arrayConfig)
    {
        $configResolver = self::createArrayConfigResolver();
        $config = $configResolver->resolve($arrayConfig);
        $responseConfig = new Element(Request::fromArray($config['request']), Response::fromArray($config['response']));
        return $responseConfig;
    }

Usage Example

Esempio n. 1
0
 function it_match_when_headers_from_config_are_equal_headers_from_request()
 {
     $responseConfig = Element::fromArray(['request' => ['path' => '/foo', 'headers' => ['Header' => 'Value', 'Header1' => 'Value1']]]);
     $request = Request::create('/foo');
     $request->headers->add(['Header' => 'Value', 'Header1' => 'Value1']);
     $this->match($request, $responseConfig)->shouldReturn(true);
 }
All Usage Examples Of Coduo\TuTu\Config\Element::fromArray