build() публичный Метод

Builds a sleep(), usleep(), date(), time() and microtime() mock environment.
public build ( ) : MockEnvironment
Результат MockEnvironment
Пример #1
0
 protected function setUp()
 {
     $builder = new SleepEnvironmentBuilder();
     $builder->addNamespace(__NAMESPACE__)->addNamespace("bandwidthThrottle\\tokenBucket\\converter")->setTimestamp(1417011228);
     $this->sleepEnvironent = $builder->build();
     $this->sleepEnvironent->enable();
 }
Пример #2
0
 protected function setUp()
 {
     parent::setUp();
     $builder = new SleepEnvironmentBuilder();
     $builder->addNamespace(__NAMESPACE__);
     $sleep = $builder->build();
     $sleep->enable();
     $this->registerForTearDown($sleep);
 }
Пример #3
0
 /**
  * Tests the example from the documentation.
  *
  * @test
  */
 public function testExample3()
 {
     $builder = new SleepEnvironmentBuilder();
     $builder->addNamespace(__NAMESPACE__)->setTimestamp(12345);
     $environment = $builder->build();
     $environment->enable();
     sleep(10);
     assert(12345 + 10 == time());
     $this->assertEquals(12345 + 10, time());
 }