Skip to content
Closed
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
46 changes: 46 additions & 0 deletions .github/smoke-test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

require getcwd() . '/vendor/autoload.php';

echo 'PHP ' . PHP_VERSION . "\n\n";

$classes = [
'Vimeo\Laravel\VimeoServiceProvider',
'Vimeo\Laravel\VimeoManager',
'Vimeo\Laravel\VimeoFactory',
'Vimeo\Laravel\Facades\Vimeo',
];

echo "Checking classes:\n";
foreach ($classes as $class) {
try {
if (!class_exists($class)) {
fwrite(STDERR, "FAIL: class not found: $class\n");
exit(1);
}
} catch (\Throwable $e) {
fwrite(STDERR, "FAIL: error loading $class: " . $e->getMessage() . "\n");
exit(1);
}
echo " [OK] $class\n";
}

echo "\nChecking service provider registration:\n";
try {
$app = new \Illuminate\Container\Container();
$provider = new \Vimeo\Laravel\VimeoServiceProvider($app);
$provider->register();
} catch (\Throwable $e) {
fwrite(STDERR, "FAIL: error registering service provider: " . $e->getMessage() . "\n");
exit(1);
}

foreach (['vimeo', 'vimeo.factory', 'vimeo.connection'] as $binding) {
if (!$app->bound($binding)) {
fwrite(STDERR, "FAIL: '$binding' not bound in container\n");
exit(1);
}
echo " [OK] '$binding' registered\n";
}

echo "\nAll smoke tests passed!\n";
40 changes: 40 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: PHP Compatibility

on:
push:
branches: [master]
pull_request:

jobs:
integration:
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
php: ['7.4', '8.0', '8.2', '8.4']

name: PHP ${{ matrix.php }} (integration)

steps:
- uses: actions/checkout@v4
with:
path: package

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

- name: Create test app
run: |
mkdir test-app
echo '{"minimum-stability":"dev","prefer-stable":true,"require":{"vimeo/laravel":"*","illuminate/container":"*"},"repositories":[{"type":"path","url":"../package","options":{"symlink":false}}]}' > test-app/composer.json

- name: Install dependencies
working-directory: test-app
run: composer install --no-dev --no-interaction --prefer-dist

- name: Run smoke test
working-directory: test-app
run: php ../package/.github/smoke-test.php
34 changes: 34 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Tests

on:
push:
branches: [master]
pull_request:

jobs:
test:
runs-on: ubuntu-latest

strategy:
fail-fast: false
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.

4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
],
"require": {
"php": "^7.2|^8.0",
"php": "^7.4|^8.0",
"illuminate/contracts": "^5.8|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0",
"illuminate/support": "^5.8|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0|^12.0|^13.0",
"graham-campbell/manager": "^5.0",
Expand All @@ -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 <hello@vinkla.com>
*
* @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 <hello@vinkla.com>
*
* @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 <hello@vinkla.com>
*
* @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 <hello@vinkla.com>
*
* @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