Ejemplo n.º 1
0
 public function testSetGetUptime()
 {
     $stats = new Stats();
     $this->assertNull($stats->getUptime());
     $stats->setUptime(10);
     $this->assertEquals('10 seconds', $stats->getUptime());
     $stats->setUptime(61);
     $this->assertEquals('1 minute 1 second', $stats->getUptime());
     $stats->setUptime(62);
     $this->assertEquals('1 minute 2 seconds', $stats->getUptime());
     $stats->setUptime(138);
     $this->assertEquals('2 minutes 18 seconds', $stats->getUptime());
     $stats->setUptime(3601);
     $this->assertEquals('1 hour 0 minutes 1 second', $stats->getUptime());
     $stats->setUptime(3662);
     $this->assertEquals('1 hour 1 minute 2 seconds', $stats->getUptime());
     $stats->setUptime(86401);
     $this->assertEquals('1 day 0 hours 0 minutes 1 second', $stats->getUptime());
     $stats->setUptime(93773);
     $this->assertEquals('1 day 2 hours 2 minutes 53 seconds', $stats->getUptime());
     $stats->setUptime(187546);
     $this->assertEquals('2 days 4 hours 5 minutes 46 seconds', $stats->getUptime());
     $stats->setUptime(187560);
     $this->assertEquals('2 days 4 hours 6 minutes 0 seconds', $stats->getUptime());
 }