Esempio n. 1
0
 public function testRateLimits()
 {
     $response = array('response_code' => 200, 'data' => array('hash' => testdata('definition_hash'), 'created_at' => date('Y-m-d H:i:s', time()), 'dpu' => 10), 'rate_limit' => 200, 'rate_limit_remaining' => 150);
     DataSift_MockApiClient::setResponse($response);
     $def = $this->user->createDefinition(testdata('definition'));
     try {
         $def->compile();
     } catch (DataSift_Exception_InvalidData $e) {
         $this->fail('InvalidData: ' . $e->getMessage() . ' (' . $e->getCode() . ')');
     } catch (DataSift_Exception_CompileFailed $e) {
         // Ignore this, irrelevant to this test
     } catch (DataSift_Exception_APIError $e) {
         // Ignore this, irrelevant to this test
     } catch (DataSift_Exception_RateLimitExceeded $e) {
         // Ignore this, irrelevant to this test
     }
     $this->assertNotEquals($this->user->getRateLimit(), -1, 'Rate limit is -1 after calling the API');
     $this->assertNotEquals($this->user->getRateLimitRemaining(), -1, 'Rate limit remaining is -1 after calling the API');
 }
Esempio n. 2
0
 public function testDelete()
 {
     $this->setResponseToSingleHistoric();
     $historic = $this->user->getHistoric(testdata('historic_playback_id'));
     $this->set204Response();
     $historic->delete();
 }
Esempio n. 3
0
 public function testGetDPUBreakdownOnInvalidDefinition()
 {
     $def = new DataSift_Definition($this->user, testdata('invalid_definition'));
     $this->assertEquals($def->get(), testdata('invalid_definition'));
     $response = array('response_code' => 400, 'data' => array('error' => 'The target interactin.content does not exist'), 'rate_limit' => 200, 'rate_limit_remaining' => 150);
     DataSift_MockApiClient::setResponse($response);
     try {
         $def->getDPUBreakdown();
         $this->fail('CompileFailed exception expected, but not thrown');
     } catch (DataSift_Exception_InvalidData $e) {
         // Check the error message
         $this->assertEquals($e->getMessage(), $response['data']['error']);
     } catch (DataSift_Exception_APIError $e) {
         $this->fail('APIError: ' . $e->getMessage() . ' (' . $e->getCode() . ')');
     } catch (Exception $e) {
         $this->fail('Unhandled exception: ' . $e->getMessage() . ' (' . $e->getCode() . ')');
     }
 }
Esempio n. 4
0
  if (useron()) {
      ?>
          <div id="UserPanel">
              <ul>
                 <?php 
      if (!alreadyowner()) {
          ?>
                  <li><a href="AddBusiness.php" target="_self">Add</a></li>
                  <?php 
          if (!isAdmin()) {
              ?>
                   <li style="background-color:gray;  padding:0.5em 2em;"><abbr title="You are not owner of One Business Record">Edit</abbr></li>
                  <li style="background-color:gray;  padding:0.5em 2em;"><abbr title="You are not owner of One Business Record">Delete</abbr></li>
                  <?php 
          } else {
              if (testdata() == true) {
                  ?>
 
                 <li><a href="Edit.php" target="_self">Edit</a></li>
               <li><a href="Delete.php" target="_self">Delete</a></li>
                      
                      <?php 
              } else {
                  ?>
                 <li style="background-color:gray;  padding:0.5em 2em;"><abbr title="You are not owner of One Business Record">Edit</abbr></li>
                  <li style="background-color:gray;  padding:0.5em 2em;"><abbr title="You are not owner of One Business Record">Delete</abbr></li>
                              
                              <?php 
              }
          }
      } else {
Esempio n. 5
0
 public function testSubscribeHistoricPlaybackId()
 {
     $this->configurePushDefinition();
     $this->setResponseToASubscription();
     $subscription = $this->pd->subscribeHistoricPlaybackId(testdata('historic_playback_id'), testdata('push_name'));
     $this->checkSubscription($subscription);
 }
Esempio n. 6
0
 public function testGetBuffered()
 {
     $def = new DataSift_Definition($this->user, testdata('definition'));
     $response = array('response_code' => 200, 'data' => array('hash' => testdata('definition_hash'), 'created_at' => date('Y-m-d H:i:s', time()), 'dpu' => 10), 'rate_limit' => 200, 'rate_limit_remaining' => 150);
     DataSift_MockApiClient::setResponse($response);
     $this->assertEquals($def->get(), testdata('definition'), 'Definition string not set correctly');
     $response = array('response_code' => 200, 'data' => array('stream' => array('Test interaction 1', 'Test interaction 2'), 'hash' => testdata('definition_hash'), 'created_at' => date('Y-m-d H:i:s', time()), 'dpu' => 10), 'rate_limit' => 200, 'rate_limit_remaining' => 150);
     DataSift_MockApiClient::setResponse($response);
     $interactions = $def->getBuffered();
     $this->assertTrue(is_array($interactions), 'Failed to get buffered interactions');
 }