Skip to content

Commit

Permalink
Merge pull request #66 from bzbislawski/master
Browse files Browse the repository at this point in the history
Upgrade to php7 and psr-4
  • Loading branch information
alaouy authored Jul 12, 2017
2 parents f6abd68 + 7f062d9 commit 9d6fca3
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 130 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
composer.phar
composer.lock
.DS_Store
.idea
15 changes: 10 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,19 @@
}
],
"require": {
"php": ">=5.3.0"
"php": "^7.0"
},
"require-dev":{
"phpunit/phpunit": "3.7.*@stable"
"require-dev": {
"phpunit/phpunit": "^6.1"
},
"autoload": {
"psr-0": {
"Alaouy\\Youtube\\": "src/"
"psr-4": {
"Alaouy\\Youtube\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"Alaouy\\Youtube\\Tests\\": "tests"
}
},
"minimum-stability": "dev"
Expand Down
84 changes: 0 additions & 84 deletions src/Alaouy/Youtube/YoutubeServiceProvider.php

This file was deleted.

File renamed without changes.
File renamed without changes.
40 changes: 40 additions & 0 deletions src/YoutubeServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace Alaouy\Youtube;

use Illuminate\Support\ServiceProvider;

class YoutubeServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->publishes(array(__DIR__ . '/config/youtube.php' => config_path('youtube.php')));
}

/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->bind('youtube', function () {
return new Youtube(config('youtube.key'));
});
}

/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return [Youtube::class];
}
}
8 changes: 0 additions & 8 deletions src/config/config.php

This file was deleted.

18 changes: 12 additions & 6 deletions src/config/youtube.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<?php
<?php

/*
|--------------------------------------------------------------------------
| Laravel PHP Facade/Wrapper for the Youtube Data API v3
|--------------------------------------------------------------------------
|
| Here is where you can set your key for Youtube API. In case you do not
| have it, it can be acquired from: https://console.developers.google.com
*/

// You can find the keys here : https://console.developers.google.com

return array(
'KEY' => 'YOUR API KEY'
);
return [
'key' => 'YOUR_API_KEY'
];
40 changes: 13 additions & 27 deletions tests/YoutubeTest.php
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
<?php

namespace Alaouy\Tests;

require_once __DIR__ . '/../vendor/autoload.php';
namespace Alaouy\Youtube\Tests;

use Alaouy\Youtube\Youtube;
use PHPUnit\Framework\TestCase;

class YoutubeTest extends \PHPUnit_Framework_TestCase
class YoutubeTest extends TestCase
{
/**
*
*
* @var Youtube
*/
const TEST_API_KEY = 'AIzaSyBPmiEELU0YEH90N2wU2sYeDvrJIoB1tqc';

/** @var Youtube */
public $youtube;

public function setUp()
{
$TEST_API_KEY = 'AIzaSyDDefsgXEZu57wYgABF7xEURClu4UAzyB8';
$this->youtube = new Youtube($TEST_API_KEY);
$this->youtube = new Youtube(self::TEST_API_KEY);
}

public function tearDown()
{
$this->youtube = null;
}

public function MalFormURLProvider()
public function urlProvider()
{
return array(
array('https://'),
array('http://www.yuotube.com'),
);
return [
['https://'],
['http://www.yuotube.com'],
];
}

/**
*
*
* @expectedException \Exception
*/
public function testConstructorFail()
Expand All @@ -45,8 +39,6 @@ public function testConstructorFail()
}

/**
*
*
* @expectedException \Exception
*/
public function testConstructorFail2()
Expand All @@ -55,8 +47,6 @@ public function testConstructorFail2()
}

/**
*
*
* @expectedException \Exception
*/
public function testInvalidApiKey()
Expand Down Expand Up @@ -244,9 +234,7 @@ public function testParseVIdFromEmbedURL()
}

/**
*
*
* @dataProvider MalFormURLProvider
* @dataProvider urlProvider
* @expectedException \Exception
*/
public function testParseVIdFromURLException($url)
Expand All @@ -255,8 +243,6 @@ public function testParseVIdFromURLException($url)
}

/**
*
*
* @expectedException \Exception
*/
public function testParseVIdException()
Expand Down

0 comments on commit 9d6fca3

Please sign in to comment.