Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Tests

on:
push:
branches: [master]
pull_request:

jobs:
test:
runs-on: ubuntu-latest

strategy:
matrix:
php: ['8.2', '8.3', '8.4']

name: PHP ${{ matrix.php }}

steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}

- name: Install dependencies
run: composer install --no-interaction

- name: Run tests
run: vendor/bin/phpunit

- name: Run Psalm
run: vendor/bin/psalm
17 changes: 0 additions & 17 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"mockery/mockery": "^1.0",
"phpunit/phpunit": "^7.0|^9.5.10|^10.5|^11.0",
"psalm/plugin-laravel": "^1.4.0|^1.1|^2.7|^3.0",
"laravel/lumen-framework": "^5.7",
"laravel/lumen-framework": "^5.7|^9.0|^10.0|^11.0",
"vimeo/psalm": "^3.17|^4.19|^5.6|^6.8"
},
"autoload": {
Expand Down
3 changes: 3 additions & 0 deletions src/Facades/Vimeo.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
* This is the Vimeo facade class.
*
* @author Vincent Klaiber <[email protected]>
*
* @psalm-api
*/
class Vimeo extends Facade
{
Expand All @@ -33,6 +35,7 @@ class Vimeo extends Facade
*
* @return string
*/
#[\Override]
protected static function getFacadeAccessor(): string
{
return 'vimeo';
Expand Down
2 changes: 2 additions & 0 deletions src/VimeoFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
* The is the Vimeo factory class.
*
* @author Vincent Klaiber <[email protected]>
*
* @psalm-api
*/
class VimeoFactory
{
Expand Down
12 changes: 7 additions & 5 deletions src/VimeoManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
* This is the Vimeo manager class.
*
* @author Vincent Klaiber <[email protected]>
*
* @psalm-api
*/
class VimeoManager extends AbstractManager
{
Expand Down Expand Up @@ -57,8 +59,11 @@ public function __construct(Repository $config, VimeoFactory $factory)
*
* @param array $config
*
* @psalm-suppress MethodSignatureMismatch
*
* @return \Vimeo\Vimeo
*/
#[\Override]
protected function createConnection(array $config): Vimeo
{
/** @var string[] $config */
Expand All @@ -70,16 +75,13 @@ protected function createConnection(array $config): Vimeo
*
* @return string
*/
#[\Override]
protected function getConfigName(): string
{
return 'vimeo';
}

/**
* Get the factory instance.
*
* @return \Vimeo\Laravel\VimeoFactory
*/
/** @psalm-api */
public function getFactory(): VimeoFactory
{
return $this->factory;
Expand Down
12 changes: 8 additions & 4 deletions src/VimeoServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
* This is the Vimeo service provider class.
*
* @author Vincent Klaiber <[email protected]>
*
* @psalm-api
*/
class VimeoServiceProvider extends ServiceProvider
{
Expand All @@ -51,7 +53,7 @@ protected function setupConfig()
{
$source = realpath(__DIR__.'/../config/vimeo.php');

if (!$source) {
if ($source === false) {
throw new \UnexpectedValueException('Could not locate config');
}

Expand All @@ -69,6 +71,7 @@ protected function setupConfig()
*
* @return void
*/
#[\Override]
public function register()
{
$this->registerFactory();
Expand Down Expand Up @@ -99,9 +102,9 @@ protected function registerManager()
{
$this->app->singleton('vimeo', function (Container $app) : VimeoManager {
/** @var \Illuminate\Contracts\Config\Repository */
$config = $app['config'];
$config = $app->make('config');
/** @var \Vimeo\Laravel\VimeoFactory */
$factory = $app['vimeo.factory'];
$factory = $app->make('vimeo.factory');

return new VimeoManager($config, $factory);
});
Expand All @@ -118,7 +121,7 @@ protected function registerBindings()
{
$this->app->bind('vimeo.connection', function (Container $app) : Vimeo {
/** @var VimeoManager */
$manager = $app['vimeo'];
$manager = $app->make('vimeo');

/** @var Vimeo */
return $manager->connection();
Expand All @@ -132,6 +135,7 @@ protected function registerBindings()
*
* @return string[]
*/
#[\Override]
public function provides(): array
{
return [
Expand Down
2 changes: 1 addition & 1 deletion tests/AbstractTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ abstract class AbstractTestCase extends AbstractPackageTestCase
*
* @return string
*/
protected function getServiceProviderClass($app)
protected static function getServiceProviderClass(): string
{
return VimeoServiceProvider::class;
}
Expand Down
4 changes: 2 additions & 2 deletions tests/AnalysisTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AnalysisTest extends TestCase
*
* @return string[]
*/
protected function getPaths()
protected static function getPaths(): array
{
return [
realpath(__DIR__.'/../config'),
Expand All @@ -51,7 +51,7 @@ protected function getPaths()
*
* @return string[]
*/
protected function getIgnored()
protected static function getIgnored()
{
return [Application::class];
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Facades/VimeoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class VimeoTest extends AbstractTestCase
*
* @return string
*/
protected function getFacadeAccessor()
protected static function getFacadeAccessor(): string
{
return 'vimeo';
}
Expand All @@ -48,7 +48,7 @@ protected function getFacadeAccessor()
*
* @return string
*/
protected function getFacadeClass()
protected static function getFacadeClass(): string
{
return Vimeo::class;
}
Expand All @@ -58,7 +58,7 @@ protected function getFacadeClass()
*
* @return string
*/
protected function getFacadeRoot()
protected static function getFacadeRoot(): string
{
return VimeoManager::class;
}
Expand Down
10 changes: 4 additions & 6 deletions tests/VimeoFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,21 @@ public function testMakeStandard()
$this->assertInstanceOf(Vimeo::class, $return);
}

/**
* @expectedException \InvalidArgumentException
*/
public function testMakeWithoutClientId()
{
$this->expectException(\InvalidArgumentException::class);

$factory = $this->getVimeoFactory();

$factory->make([
'client_secret' => 'your-client-secret',
]);
}

/**
* @expectedException \InvalidArgumentException
*/
public function testMakeWithoutClientSecret()
{
$this->expectException(\InvalidArgumentException::class);

$factory = $this->getVimeoFactory();

$factory->make([
Expand Down
Loading