public function all() { foreach ($this->ciphers as $name => $cipher) { $this->load($name); } return parent::all(); }
public function testGettersSetters() { $encryptor1Name = $this->getFaker()->unique()->word; $encryptor1 = \Mockery::mock('Giftcards\\Encryption\\Cipher\\CipherInterface')->shouldReceive('getName')->andReturn($encryptor1Name)->getMock(); $encryptor2Name = $this->getFaker()->unique()->word; $encryptor2 = \Mockery::mock('Giftcards\\Encryption\\Cipher\\CipherInterface')->shouldReceive('getName')->andReturn($encryptor2Name)->getMock(); $encryptor3Name = $this->getFaker()->unique()->word; $encryptor3 = \Mockery::mock('Giftcards\\Encryption\\Cipher\\CipherInterface')->shouldReceive('getName')->andReturn($encryptor3Name)->getMock(); $this->assertSame($this->registry, $this->registry->add($encryptor1)); $this->assertSame($this->registry, $this->registry->add($encryptor2)); $this->assertSame($this->registry, $this->registry->add($encryptor3)); $this->assertTrue($this->registry->has($encryptor1Name)); $this->assertSame($encryptor1, $this->registry->get($encryptor1Name)); $this->assertTrue($this->registry->has($encryptor2Name)); $this->assertSame($encryptor2, $this->registry->get($encryptor2Name)); $this->assertTrue($this->registry->has($encryptor3Name)); $this->assertSame($encryptor3, $this->registry->get($encryptor3Name)); $this->assertFalse($this->registry->has($this->getFaker()->unique()->word)); $this->assertEquals(array($encryptor1Name => $encryptor1, $encryptor2Name => $encryptor2, $encryptor3Name => $encryptor3), $this->registry->all()); }