示例#1
0
 function it_resolve_config_when_matching_policy_match_request_to_response_config(Loader $loader, MatchingPolicy $matchingPolicy)
 {
     $loader->getResponsesArray()->willReturn([['request' => ['path' => '/foo/index', 'methods' => ['POST']]]]);
     $request = Request::create('/foo/index', 'POST');
     $matchingPolicy->match($request, Argument::type('Coduo\\TuTu\\Config\\Element'))->willReturn(true);
     $this->resolveConfigElement($request)->shouldReturnAnInstanceOf('Coduo\\TuTu\\Config\\Element');
 }
示例#2
0
文件: Resolver.php 项目: coduo/tutu
 /**
  * @param Loader $loader
  * @param MatchingPolicy $matchingPolicy
  */
 public function __construct(Loader $loader, MatchingPolicy $matchingPolicy)
 {
     $this->configs = [];
     foreach ($loader->getResponsesArray() as $responseArrayConfig) {
         $this->configs[] = Element::fromArray($responseArrayConfig);
     }
     $this->matchingPolicy = $matchingPolicy;
 }