/** * @test */ public function createWithPreferences() { $deathByCaptcha = DeathByCaptchaFactory::createWithPreferences(UsernamePasswordCredentials::fromUsernameAndPassword('foo', 'bar'), PullPreferences::fromPreferences(10, 10)); $this->assertInstanceOf(DeathByCaptchaInterface::class, $deathByCaptcha); }
/** * @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)); }
/** * @test */ public function fromPreferences() { $preferences = PullPreferences::fromPreferences(10, 10); $this->assertEquals(10, $preferences->getInterval()); $this->assertEquals(10, $preferences->getMaxAttempts()); }