public static function setUpBeforeClass()
 {
     self::$tokenStore = ObjectStorage_TokenStore::factory('file', array('ttl' => 3600, 'path' => '/tmp'));
     $options = array('adapter' => ObjectStorage_Http_Client::SOCKET, 'timeout' => 10);
     ObjectStorage::setTokenStore(self::$tokenStore);
     $objectStorage01 = new ObjectStorage(self::$host, self::$username, self::$password, $options);
     self::$objectStorage = $objectStorage01;
 }
 public function testMemoryStore()
 {
     $tokenStore = ObjectStorage_TokenStore::factory('memory');
     self::$key = 'phpunit_' . time();
     self::$testData = array('data' => md5('TEST VALUE'));
     $result = $tokenStore->set(self::$key, self::$testData);
     $this->assertTrue($result, 'Failed to add data.');
     $retrievedData = $tokenStore->get(self::$key);
     $this->assertEquals(self::$testData['data'], $retrievedData['data']);
     $resultDelete = $tokenStore->delete(self::$key, self::$testData);
     $this->assertTrue($resultDelete, 'Failed to delete data.');
 }
Ejemplo n.º 3
0
 protected static function getTokenStore()
 {
     if (!self::$tokenStore instanceof ObjectStorage_TokenStore_Interface) {
         self::$tokenStore = ObjectStorage_TokenStore::factory('memory');
     }
     return self::$tokenStore;
 }
 /**
  * testAuthenticationWithBadCredentials test sets a dummy token store.
  * We need to set the proper token store object for other test(s).
  */
 public function setUp()
 {
     self::$tokenStore = ObjectStorage_TokenStore::factory('file', array('ttl' => 3600, 'path' => '/tmp'));
     ObjectStorage::setTokenStore(self::$tokenStore);
 }