コード例 #1
0
   public function testThrowExceptionOnActivityFeedRequestForMoreThan20Users()
   {
        $exceptionThrown = false;
        $listOfMoreThan20Users = null;
        $youtube = new YouTube();
        $youtube->setMajorProtocolVersion(2);

        for ($x = 0;  $x < 30; $x++) {
            $listOfMoreThan20Users .= "user$x";
            if ($x != 29) {
                $listOfMoreThan20Users .= ",";
            }
        }

        try {
            $youtube->getActivityForUser($listOfMoreThan20Users);
        } catch (App\InvalidArgumentException $e) {
            $exceptionThrown = true;
        }
        $this->assertTrue($exceptionThrown, 'Was expecting an exception on ' .
            'a request to ->getActivityForUser when more than 20 users were ' .
            'specified in YouTube.php');
    }