public function testConstructAndDefaults() { $c = new ArrayCache(); $b = new CircuitBreaker('tests', $c); $this->assertEquals('tests', $b->getName()); $this->assertEquals($c, $b->getStorage()); $this->assertEquals(5, $b->getThreshold()); $this->assertEquals(300, $b->getCooldown()); $this->assertFalse($b->isOpen()); $this->assertTrue($b->isClosed()); }
/** * Allows you to set a breaker onto the board that you may have created elsewhere. * * @param CircuitBreaker $breaker * @return $this */ public function setBreaker(CircuitBreaker $breaker) { $this->instances[$breaker->getName()] = $breaker; return $this; }