Example #1
0
 /**
  *
  * @return void
  */
 public function testTagsAndBundles()
 {
     // get tags
     $tags = $this->delicious->getTags();
     $this->assertInternalType('array', $tags);
     $tags = array_keys($tags);
     if (count($tags) < 1) {
         $this->fail('Test account corrupted - no tags');
     }
     $oldTagName = $tags[0];
     $newTagName = uniqid('tag');
     // rename tag
     $this->delicious->renameTag($oldTagName, $newTagName);
     sleep(self::API_CALL_INTERVAL);
     // get renamed tags
     $tags = $this->delicious->getTags();
     $this->assertArrayHasKey($newTagName, $tags);
     $this->assertArrayNotHasKey($oldTagName, $tags);
     $tags = array_keys($tags);
     // add new bundle
     $newBundleName = uniqid('bundle');
     $this->delicious->addBundle($newBundleName, $tags);
     sleep(self::API_CALL_INTERVAL);
     // check if bundle was added
     $bundles = $this->delicious->getBundles();
     $this->assertInternalType('array', $bundles);
     $this->assertArrayHasKey($newBundleName, $bundles);
     $this->assertEquals($tags, $bundles[$newBundleName]);
     // delete bundle
     $this->delicious->deleteBundle($newBundleName);
     sleep(self::API_CALL_INTERVAL);
     // check if bundle was deleted
     $bundles = $this->delicious->getBundles();
     $this->assertArrayNotHasKey($newBundleName, $bundles);
 }