public function setUp() { $this->flagManager = $this->getMockBuilder("Scheb\\TwoFactorBundle\\Security\\TwoFactor\\Session\\SessionFlagManager")->disableOriginalConstructor()->getMock(); $this->provider = $this->getMock("Scheb\\TwoFactorBundle\\Security\\TwoFactor\\Provider\\TwoFactorProviderInterface"); $this->collection = new TwoFactorProviderCollection(); $this->collection->addProvider('test', $this->provider); $this->registry = new TwoFactorProviderRegistry($this->flagManager, $this->collection); }
/** * @test */ public function addProvider_getProviders() { $collection = new TwoFactorProviderCollection(); $provider = $this->getMock("Scheb\\TwoFactorBundle\\Security\\TwoFactor\\Provider\\TwoFactorProviderInterface"); $collection->addProvider('test', $provider); $providers = $collection->getProviders(); $this->assertEquals(array('test' => $provider), $providers); }
private function getProviderCollection($providers = true) { $providerCollection = new TwoFactorProviderCollection(); if (true === $providers) { $providerCollection->addProvider('test', $this->provider); } return $providerCollection; }