/**
  * It should stay closed if the minimum request threshold hasn't been met.
  * @test
  */
 public function canStayClosedIfCustomMinimumRequestThresholdNotMet()
 {
     $config = ['minimumRequestsBeforeTrigger' => 5];
     $this->sut = CircuitBreakerBuilder::create('myService')->withConfig($config)->withCache($this->cache)->withTimeProvider($this->timeProvider)->build();
     $this->assertTrue($this->sut->isClosed());
     $this->timeProvider->set(0);
     $this->sut->registerFailure();
     $this->assertTrue($this->sut->isClosed());
     $this->timeProvider->set(30);
     $this->sut->registerSuccess();
     $this->assertTrue($this->sut->isClosed());
     $this->timeProvider->set(58);
     $this->sut->registerFailure();
     $this->assertTrue($this->sut->isClosed());
     $this->timeProvider->set(59);
     $this->sut->registerFailure();
     $this->assertTrue($this->sut->isClosed());
     $this->timeProvider->set(60);
     $this->assertTrue($this->sut->isClosed());
     // Cheekily add another request to the previous minute.
     $this->timeProvider->set(57);
     $this->sut->registerFailure();
     $this->timeProvider->set(60);
     $this->assertFalse($this->sut->isClosed());
 }
 /**
  * @test
  */
 public function canBuildCounterFromMemcachedServer()
 {
     $cb = \itsoneiota\circuitbreaker\CircuitBreakerBuilder::create('myService')->withMemcachedServer('localhost', '1001')->build();
     $this->assertTrue(TRUE);
 }