コード例 #1
0
 public function testPostHash()
 {
     $indexId = 'ABCD-12345';
     $derivedKey = 'secretKey';
     $index = AcquiaSearchClient::factory(array('index_id' => $indexId, 'derived_key' => $derivedKey));
     $request = $index->post('/update?wt=json', null, 'Some Body');
     $signature = new Signature($derivedKey);
     $signature->setRequestTime(12345);
     $auth = new AcquiaSearchAuthPlugin($indexId, $signature);
     $auth->signRequest($request);
     $cookie = $request->getHeader('Cookie');
     $expected = 'acquia_solr_time=12345; acquia_solr_nonce=12345678; acquia_solr_hmac=e006724d186805fdc0999cd1b132a9f78786b7f4;';
     $this->assertEquals($expected, (string) $cookie);
 }
コード例 #2
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testRequireDerivedKey()
 {
     AcquiaSearchClient::factory(array('index_id' => 'test_id'));
 }