/**
  * @test
  */
 public function requestSolutionForCaptcha()
 {
     /* @var \PHPUnit_Framework_MockObject_MockObject|DeathByCaptchaInterface $deathByCaptcha */
     $deathByCaptcha = $this->getMock(DeathByCaptchaInterface::class);
     $deathByCaptcha->expects($this->once())->method('requestSolutionForCaptcha')->with($this->isInstanceOf(CaptchaInterface::class));
     $only = new OnlyBase64AndFilesystemImageCaptcha($deathByCaptcha);
     $only->requestSolutionForCaptcha(Base64Captcha::fromString(''));
 }
 /**
  * {@inheritDoc}
  * @param FilesystemImageCaptcha $captcha
  */
 public function requestSolutionForCaptcha(CaptchaInterface $captcha)
 {
     if ($captcha instanceof FilesystemImageCaptcha) {
         $base64 = base64_encode(file_get_contents($captcha->getPath()));
         unlink($captcha->getPath());
         $captcha = Base64Captcha::fromString($base64);
     }
     return parent::requestSolutionForCaptcha($captcha);
 }
예제 #3
0
 /**
  * {@inheritDoc}
  */
 protected function setUp()
 {
     $this->credentials = UsernamePasswordCredentials::fromUsernameAndPassword('usr', 'pswd');
     $this->captcha = Base64Captcha::fromString('');
 }
예제 #4
0
 /**
  * @test
  */
 public function toString()
 {
     $base64 = base64_encode(uniqid('', true));
     $captcha = Base64Captcha::fromString($base64);
     $this->assertSame($base64, (string) $captcha);
 }