From 5c7f2f17f9c471d306955df457c7cab4e5c6ed3b Mon Sep 17 00:00:00 2001 From: Snap Date: Thu, 16 Apr 2015 14:51:26 -0700 Subject: Google's OpenID Connect method $google_client_id & $google_client_secret must be added to db.inc.php! --- .../tests/youtube/YouTubeTest.php | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 includes/google-api-php-client-master/tests/youtube/YouTubeTest.php (limited to 'includes/google-api-php-client-master/tests/youtube/YouTubeTest.php') diff --git a/includes/google-api-php-client-master/tests/youtube/YouTubeTest.php b/includes/google-api-php-client-master/tests/youtube/YouTubeTest.php new file mode 100644 index 0000000..252ef04 --- /dev/null +++ b/includes/google-api-php-client-master/tests/youtube/YouTubeTest.php @@ -0,0 +1,82 @@ +youtube = new Google_Service_YouTube($this->getClient()); + } + + public function testMissingFieldsAreNull() + { + if (!$this->checkToken()) { + return; + } + + $parts = "id,brandingSettings"; + $opts = array("mine" => true); + $channels = $this->youtube->channels->listChannels($parts, $opts); + + $newChannel = new Google_Service_YouTube_Channel(); + $newChannel->setId($channels[0]->getId()); + $newChannel->setBrandingSettings($channels[0]->getBrandingSettings()); + + $simpleOriginal = $channels[0]->toSimpleObject(); + $simpleNew = $newChannel->toSimpleObject(); + + $this->assertObjectHasAttribute('etag', $simpleOriginal); + $this->assertObjectNotHasAttribute('etag', $simpleNew); + + $owner_details = new Google_Service_YouTube_ChannelContentOwnerDetails(); + $owner_details->setTimeLinked("123456789"); + $o_channel = new Google_Service_YouTube_Channel(); + $o_channel->setContentOwnerDetails($owner_details); + $simpleManual = $o_channel->toSimpleObject(); + $this->assertObjectHasAttribute('timeLinked', $simpleManual->contentOwnerDetails); + $this->assertObjectNotHasAttribute('contentOwner', $simpleManual->contentOwnerDetails); + + $owner_details = new Google_Service_YouTube_ChannelContentOwnerDetails(); + $owner_details->timeLinked = "123456789"; + $o_channel = new Google_Service_YouTube_Channel(); + $o_channel->setContentOwnerDetails($owner_details); + $simpleManual = $o_channel->toSimpleObject(); + + $this->assertObjectHasAttribute('timeLinked', $simpleManual->contentOwnerDetails); + $this->assertObjectNotHasAttribute('contentOwner', $simpleManual->contentOwnerDetails); + + $owner_details = new Google_Service_YouTube_ChannelContentOwnerDetails(); + $owner_details['timeLinked'] = "123456789"; + $o_channel = new Google_Service_YouTube_Channel(); + $o_channel->setContentOwnerDetails($owner_details); + $simpleManual = $o_channel->toSimpleObject(); + + $this->assertObjectHasAttribute('timeLinked', $simpleManual->contentOwnerDetails); + $this->assertObjectNotHasAttribute('contentOwner', $simpleManual->contentOwnerDetails); + + $ping = new Google_Service_YouTube_ChannelConversionPing(); + $ping->setContext("hello"); + $pings = new Google_Service_YouTube_ChannelConversionPings(); + $pings->setPings(array($ping)); + $simplePings = $pings->toSimpleObject(); + $this->assertObjectHasAttribute('context', $simplePings->pings[0]); + $this->assertObjectNotHasAttribute('conversionUrl', $simplePings->pings[0]); + } +} -- cgit v1.2.3