<?php
/**
 * @author           Pierre-Henry Soria <hello@ph7cms.com>
 * @copyright        (c) 2017-2018, Pierre-Henry Soria. All Rights Reserved.
 * @license          GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
 * @package          PH7 / Test / Unit / Framework / Video / Api
 */

namespace PH7\Test\Unit\Framework\Video\Api;

use PH7\Framework\Video\Api\Youtube;
use PHPUnit_Framework_TestCase;

class YoutubeTest extends PHPUnit_Framework_TestCase
{
    /** @var Youtube */
    private $oYoutube;

    protected function setUp()
    {
        $this->oYoutube = new Youtube;
    }

    public function testApiKeyIsSet()
    {
        $this->oYoutube->setKey('OIzaSyBu-916IsoKajomJNIgngS6HL_kDIKU0aU');
        $this->assertTrue($this->oYoutube->isApiKeySet());
    }

    public function testWrongApiKeySet()
    {
        $this->oYoutube->setKey('invalid_key');
        $this->assertFalse($this->oYoutube->isApiKeySet());
    }

    public function testApiKeyIsNotSet()
    {
        $this->assertFalse($this->oYoutube->isApiKeySet());
    }
}

<?php
/**
 * @author           Pierre-Henry Soria <hello@ph7cms.com>
 * @copyright        (c) 2017-2018, Pierre-Henry Soria. All Rights Reserved.
 * @license          GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
 * @package          PH7 / Test / Unit / Framework / Video / Api
 */

namespace PH7\Test\Unit\Framework\Video\Api;

use PH7\Framework\Video\Api\Youtube;
use PHPUnit_Framework_TestCase;

class YoutubeTest extends PHPUnit_Framework_TestCase
{
    /** @var Youtube */
    private $oYoutube;

    protected function setUp()
    {
        $this->oYoutube = new Youtube;
    }

    public function testApiKeyIsSet()
    {
        $this->oYoutube->setKey('OIzaSyBu-916IsoKajomJNIgngS6HL_kDIKU0aU');
        $this->assertTrue($this->oYoutube->isApiKeySet());
    }

    public function testWrongApiKeySet()
    {
        $this->oYoutube->setKey('invalid');
        $this->assertFalse($this->oYoutube->isApiKeySet());
    }

    public function testApiKeyIsNotSet()
    {
        $this->assertFalse($this->oYoutube->isApiKeySet());
    }
}

Update Wrong API key test
Update Wrong API key test

Because now, the minimum key length is 10 chars
