Esempio n. 1
0
 function it_should_fallback_on_the_default_user_agent_if_the_url_is_indexable_with_a_specific_user_agent(UserAgent $default, UserAgent $googlebot)
 {
     $default->getName()->willReturn(File::DEFAULT_UA_NAME);
     $googlebot->getName()->willReturn('google');
     $this->addUserAgent($default);
     $this->addUserAgent($googlebot);
     $googlebot->isUrlAllowed('/foo')->shouldBeCalled()->willReturn(true);
     $default->isUrlAllowed('/foo')->shouldBeCalled()->willReturn(true);
     $this->isUrlAllowedByUserAgent('/foo', 'google')->shouldReturn(true);
     $googlebot->isUrlAllowed('/bar')->shouldBeCalled()->willReturn(false);
     $this->isUrlAllowedByUserAgent('/bar', 'google')->shouldReturn(false);
     $googlebot->isUrlAllowed('/baz')->shouldBeCalled()->willReturn(true);
     $default->isUrlAllowed('/baz')->shouldBeCalled()->willReturn(false);
     $this->isUrlAllowedByUserAgent('/baz', 'google')->shouldReturn(false);
 }
Esempio n. 2
0
 /**
  * @param UserAgent $userAgent
  */
 public function addUserAgent(UserAgent $userAgent)
 {
     $this->userAgents[$userAgent->getName()] = $userAgent;
 }