public function testAddUpdateAndDeletePlaylistV2()
 {
     $service = YouTube::AUTH_SERVICE_NAME;
     $authenticationURL = 'https://www.google.com/youtube/accounts/ClientLogin';
     $httpClient = ClientLogin::getHttpClient($this->user, $this->pass, $service, null, 'Google-UnitTests-1.0', null, null, $authenticationURL);
     $yt = new YouTube($httpClient, 'Google-UnitTests-1.0', 'ytapi-gdataops-12345-u78960r7-0', 'AI39si6c-ZMGFZ5fkDAEJoCNHP9LOM2LSO1XuycZF7E' . 'yu1IuvkioESqzRcf3voDLymIUGIrxdMx2aTufdbf5D7E51NyLYyfeaw');
     $yt->setMajorProtocolVersion(2);
     $feed = $yt->getPlaylistListFeed($this->ytAccount);
     // Add new
     $newPlaylist = $yt->newPlaylistListEntry();
     $newPlaylist->setMajorProtocolVersion(2);
     $titleString = $this->generateRandomString(10);
     $newPlaylist->title = $yt->newTitle()->setText($titleString);
     $newPlaylist->summary = $yt->newSummary()->setText('testing');
     $postUrl = 'https://gdata.youtube.com/feeds/api/users/default/playlists';
     $successfulInsertion = true;
     try {
         $yt->insertEntry($newPlaylist, $postUrl);
     } catch (App\Exception $e) {
         $successfulInsertion = false;
     }
     $this->assertTrue($successfulInsertion, 'Failed to insert a new ' . 'playlist.');
     $playlistListFeed = $yt->getPlaylistListFeed('default');
     $playlistFound = false;
     $newPlaylistEntry = null;
     foreach ($playlistListFeed as $playlistListEntry) {
         if ($playlistListEntry->title->text == $titleString) {
             $playlistFound = true;
             $newPlaylistEntry = $playlistListEntry;
             break;
         }
     }
     $this->assertTrue($playlistFound, 'Could not find the newly inserted ' . 'playlist.');
     // Update it
     $newTitle = $this->generateRandomString(10);
     $newPlaylistEntry->title->setText($newTitle);
     $updatedSuccesfully = true;
     try {
         $newPlaylistEntry->save();
     } catch (App\Exception $e) {
         $updatedSuccesfully = false;
     }
     $this->assertTrue($updatedSuccesfully, 'Could not succesfully update ' . 'a new playlist.');
     // Delete it
     $deletedSuccesfully = true;
     try {
         $newPlaylistEntry->delete();
     } catch (App\Exception $e) {
         $deletedSuccesfully = false;
     }
     $this->assertTrue($deletedSuccesfully, 'Could not succesfully delete ' . 'a new playlist.');
 }