Пример #1
0
 public function testDecrypt()
 {
     $cipherText1 = $this->getFaker()->unique()->word;
     $plainText1 = $this->getFaker()->unique()->word;
     $this->cipherRegistry->get($this->cipher1Name)->shouldReceive('decipher')->once()->with($cipherText1, $this->keySource->get($this->key1Name))->andReturn($plainText1);
     $this->serializerDeserializer->shouldReceive('deserialize')->once()->with($cipherText1)->andReturn(new CipherText($cipherText1, $this->profileRegistry->get($this->profile1Name)));
     $this->assertEquals($plainText1, $this->encryptor->decrypt($cipherText1));
     $this->cipherRegistry->get($this->cipher1Name)->shouldReceive('decipher')->once()->with($cipherText1, $this->keySource->get($this->key1Name))->andReturn($plainText1);
     $this->serializerDeserializer->shouldReceive('deserialize')->once()->with($cipherText1)->andReturn(new CipherText($cipherText1, $this->profileRegistry->get($this->profile1Name)));
     $this->assertEquals($plainText1, $this->encryptor->decrypt($cipherText1, $this->profile1Name));
     $cipherText2 = $this->getFaker()->unique()->word;
     $plainText2 = $this->getFaker()->unique()->word;
     $this->cipherRegistry->get($this->cipher2Name)->shouldReceive('decipher')->once()->with($cipherText2, $this->keySource->get($this->key2Name))->andReturn($plainText2);
     $this->assertEquals($plainText2, $this->encryptor->decrypt(new CipherText($cipherText2, $this->profileRegistry->get($this->profile2Name))));
 }
 public function testCreateDriver()
 {
     /** @var m\MockInterface $driver_factory */
     $driver_factory = $this->driverFactoryRegistry->get('selenium2');
     $driver_factory->shouldReceive('createDriver')->with($this->browser)->once()->andReturn('OK');
     $this->assertEquals('OK', $this->browser->createDriver());
 }
 /**
  * @expectedException \OutOfBoundsException
  * @expectedExceptionMessage No driver factory for "test" driver.
  */
 public function testGettingNonExisting()
 {
     $this->_driverFactoryRegistry->get('test');
 }