Пример #1
0
 public function build()
 {
     $rotatorRegistry = new RotatorRegistry();
     foreach ($this->rotators as $name => $rotator) {
         $rotatorRegistry->set($name, $rotator);
     }
     return $rotatorRegistry;
 }
Пример #2
0
 /**
  * @expectedException \Giftcards\Encryption\CipherText\Rotator\RotatorNotFoundException
  */
 public function testGetWhereNotThere()
 {
     $rotator1 = \Mockery::mock('Giftcards\\Encryption\\CipherText\\Rotator\\RotatorInterface');
     $rotator1Name = $this->getFaker()->unique()->word;
     $rotator2 = \Mockery::mock('Giftcards\\Encryption\\CipherText\\Rotator\\RotatorInterface');
     $rotator2Name = $this->getFaker()->unique()->word;
     $rotator3 = \Mockery::mock('Giftcards\\Encryption\\CipherText\\Rotator\\RotatorInterface');
     $rotator3Name = $this->getFaker()->unique()->word;
     $this->registry->set($rotator1Name, $rotator1)->set($rotator2Name, $rotator2)->set($rotator3Name, $rotator3)->get($this->getFaker()->unique()->word);
 }
 public function testBuildWithBuilders()
 {
     $name1 = $this->getFaker()->unique()->word;
     $name2 = $this->getFaker()->unique()->word;
     $name3 = $this->getFaker()->unique()->word;
     $factoryName = $this->getFaker()->unique()->word;
     $factoryOptions = array($this->getFaker()->unique()->word => $this->getFaker()->unique()->word, $this->getFaker()->unique()->word => $this->getFaker()->unique()->word, $this->getFaker()->unique()->word => $this->getFaker()->unique()->word);
     $source3 = \Mockery::mock('Giftcards\\Encryption\\CipherText\\Rotator\\RotatorInterface');
     $this->factory->shouldReceive('create')->once()->with($factoryName, $factoryOptions)->andReturn($source3);
     $this->builder->set($name1, $this->rotator1)->set($name2, $this->rotator2)->set($name3, $factoryName, $factoryOptions);
     $registry = new RotatorRegistry();
     $registry->set($name1, $this->rotator1)->set($name2, $this->rotator2)->set($name3, $source3);
     $this->assertEquals($registry, $this->builder->build());
 }
 public function all()
 {
     foreach ($this->rotators as $name => $rotator) {
         $this->load($name);
     }
     return parent::all();
 }