/**
  * @test
  */
 public function createWithPreferences()
 {
     $deathByCaptcha = DeathByCaptchaFactory::createWithPreferences(UsernamePasswordCredentials::fromUsernameAndPassword('foo', 'bar'), PullPreferences::fromPreferences(10, 10));
     $this->assertInstanceOf(DeathByCaptchaInterface::class, $deathByCaptcha);
 }
예제 #2
0
 /**
  * @test
  */
 public function pullSolutionForReturnsFalse()
 {
     $mock = new Mock([new Response(200, [], Stream::factory(json_encode(['captcha' => uniqid('', true), 'text' => '']))), new Response(200, [], Stream::factory(json_encode(['captcha' => uniqid('', true), 'text' => '']))), new Response(200, [], Stream::factory(json_encode(['captcha' => uniqid('', true), 'text' => ''])))]);
     $httpClient = new Client();
     $httpClient->getEmitter()->attach($mock);
     $deathByCaptcha = new DeathByCaptcha($this->credentials, PullPreferences::fromPreferences(0, 1), $httpClient);
     $this->assertFalse($deathByCaptcha->requestSolutionForCaptcha($this->captcha));
 }
예제 #3
0
 /**
  * @test
  */
 public function fromPreferences()
 {
     $preferences = PullPreferences::fromPreferences(10, 10);
     $this->assertEquals(10, $preferences->getInterval());
     $this->assertEquals(10, $preferences->getMaxAttempts());
 }