public static function getEnvironmentFromJsonString($string) { $environment = new Application_Model_Environment(); $environment->fromJson($string); $environment->clearExpiredLock(); return $environment; }
public function testClearExpiredLock_NotLockedAndExpired() { $env = new Application_Model_Environment(); $env->locked = false; $until = new DateTime(); date_sub($until, DateInterval::createFromDateString("5 second")); $env->until = $until->format("Y-m-d H:i:s"); $env->by = 'by'; $env->clearExpiredLock(); $this->assertFalse($env->locked); $this->assertEquals($until->format("Y-m-d H:i:s"), $env->until); $this->assertEquals('by', $env->by); }