Пример #1
0
 public function testGettersAndSetters()
 {
     $this->assertmd5($this->object->get_value());
     $value = md5('prout');
     $this->object->set_value($value);
     $this->assertEquals($value, $this->object->get_value());
     $this->object->set_session_id(null);
     $this->assertNull($this->object->get_session_id());
     $this->object->set_session_id(458);
     $this->assertEquals(458, $this->object->get_session_id());
     $expire = time() + 3600;
     $this->object->set_expires($expire);
     $diff = (int) $this->object->get_expires() - time();
     $this->assertSame($expire, $this->object->get_expires(), "expiration timestamp is string : " . $this->object->get_expires());
     $this->assertTrue($diff > 3500, "expire value {$diff} should be more than 3500 seconds ");
     $this->assertTrue($diff < 3700, "expire value {$diff} should be less than 3700 seconds ");
     $date = time() + 7200;
     $this->object->set_expires($date);
     $this->assertEquals($date, $this->object->get_expires());
     $this->assertNull($this->object->get_scope());
     $this->assertNull($this->object->get_scope());
     $scope = "prout";
     $this->object->set_scope($scope);
     $this->assertEquals($scope, $this->object->get_scope());
     $this->assertInstanceOf('API_OAuth2_Account', $this->object->get_account());
 }