Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.0 #237

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

6.0 #237

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
6 changes: 0 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,11 @@ jobs:
strategy:
matrix:
php:
- "8.1"
- "8.2"
- "8.3"
- "8.4"
laravel:
- "9"
- "10"
- "11"
exclude:
- php: "8.1"
laravel: "11"

steps:
- name: Checkout code
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## Unreleased

* Dropped support for Laravel 9 and 10

## 5.10.0 - 2024-11-22

* Added support for PHP 8.4
Expand Down
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@
}
],
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
"php": "~8.2.0 || ~8.3.0 || ~8.4.0",
"kreait/firebase-php": "^7.13",
"illuminate/contracts": "^9.0 || ^10.0 || ^11.0",
"illuminate/support": "^9.0 || ^10.0 || ^11.0",
"illuminate/contracts": "^11.0",
"illuminate/notifications": "^11.0",
"illuminate/support": "^11.0",
"symfony/cache": "^6.1.2 || ^7.0.3"
},
"require-dev": {
"orchestra/testbench": "^7.0 || ^8.0 || ^9.0",
"orchestra/testbench": "^9.0",
"laravel/pint": "^1.14",
"phpunit/phpunit": "^9.6.17 || ^10.5.13"
"phpunit/phpunit": "^11.4.3"
},
"autoload": {
"psr-4": {
Expand Down
14 changes: 7 additions & 7 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
beStrictAboutOutputDuringTests="true"
colors="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
beStrictAboutOutputDuringTests="true"
colors="true"
>
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>

<coverage ignoreDeprecatedCodeUnits="true" processUncoveredFiles="true">
<source>
<include>
<directory suffix=".php">src</directory>
<directory>src</directory>
</include>
<exclude>
<directory>src/Facades</directory>
</exclude>
</coverage>
</source>

<php>
<ini name="date.timezone" value="UTC"/>
Expand Down
2 changes: 1 addition & 1 deletion src/FirebaseProjectManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ protected function resolveJsonCredentials(string $credentials): string

protected function configure(string $name): FirebaseProject
{
$factory = new Factory();
$factory = new Factory;

$config = $this->configuration($name);

Expand Down
65 changes: 17 additions & 48 deletions tests/FirebaseProjectManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Kreait\Firebase\Exception\InvalidArgumentException;
use Kreait\Firebase\Factory;
use Kreait\Laravel\Firebase\FirebaseProjectManager;
use PHPUnit\Framework\Attributes\Test;
use Psr\Cache\CacheItemPoolInterface;
use ReflectionObject;

Expand All @@ -22,9 +23,7 @@ protected function defineEnvironment($app): void
$app['config']->set('firebase.projects.app.credentials', __DIR__.'/_fixtures/service_account.json');
}

/**
* @test
*/
#[Test]
public function a_project_configuration_has_to_exist(): void
{
$manager = $this->app->make(FirebaseProjectManager::class);
Expand All @@ -36,9 +35,7 @@ public function a_project_configuration_has_to_exist(): void
$this->getAccessibleMethod($manager, 'configuration')->invoke($manager, $projectName);
}

/**
* @test
*/
#[Test]
public function a_default_project_can_be_set(): void
{
$manager = $this->app->make(FirebaseProjectManager::class);
Expand All @@ -51,9 +48,7 @@ public function a_default_project_can_be_set(): void
$this->assertSame($projectName, $this->app->config->get('firebase.default'), 'default project should be set in config');
}

/**
* @test
*/
#[Test]
public function calls_are_passed_to_default_project(): void
{
$manager = $this->app->make(FirebaseProjectManager::class);
Expand All @@ -63,9 +58,7 @@ public function calls_are_passed_to_default_project(): void
$this->assertSame($manager->project($projectName)->auth(), $manager->auth());
}

/**
* @test
*/
#[Test]
public function credentials_can_be_configured_using_a_json_file(): void
{
// Reference credentials
Expand All @@ -84,9 +77,7 @@ public function credentials_can_be_configured_using_a_json_file(): void
$this->assertSame($credentials, $serviceAccount);
}

/**
* @test
*/
#[Test]
public function json_file_credentials_can_be_used_using_the_deprecated_configuration_entry(): void
{
// Reference credentials
Expand All @@ -105,9 +96,7 @@ public function json_file_credentials_can_be_used_using_the_deprecated_configura
$this->assertSame($credentials, $serviceAccount);
}

/**
* @test
*/
#[Test]
public function credentials_can_be_configured_using_an_array(): void
{
// Set configuration and retrieve project
Expand All @@ -133,9 +122,7 @@ public function credentials_can_be_configured_using_an_array(): void
$this->assertSame($credentials, $serviceAccount);
}

/**
* @test
*/
#[Test]
public function projects_can_have_different_credentials(): void
{
// Reference credentials
Expand Down Expand Up @@ -165,9 +152,7 @@ public function projects_can_have_different_credentials(): void
$this->assertSame($secondCredentials, $secondServiceAccount);
}

/**
* @test
*/
#[Test]
public function the_realtime_database_url_can_be_configured(): void
{
$projectName = $this->app->config->get('firebase.default');
Expand All @@ -181,9 +166,7 @@ public function the_realtime_database_url_can_be_configured(): void
$this->assertSame($url, (string) $property->getValue($database));
}

/**
* @test
*/
#[Test]
public function the_dynamic_links_default_domain_can_be_configured(): void
{
$projectName = $this->app->config->get('firebase.default');
Expand All @@ -198,9 +181,7 @@ public function the_dynamic_links_default_domain_can_be_configured(): void
$this->assertSame($domain, $configuredDomain);
}

/**
* @test
*/
#[Test]
public function the_storage_default_bucket_can_be_configured(): void
{
$projectName = $this->app->config->get('firebase.default');
Expand All @@ -213,9 +194,7 @@ public function the_storage_default_bucket_can_be_configured(): void
$this->assertSame($name, $property->getValue($storage));
}

/**
* @test
*/
#[Test]
public function logging_can_be_configured(): void
{
$projectName = $this->app->config->get('firebase.default');
Expand All @@ -228,9 +207,7 @@ public function logging_can_be_configured(): void
$this->assertNotNull($property->getValue($factory));
}

/**
* @test
*/
#[Test]
public function debug_logging_can_be_configured(): void
{
$projectName = $this->app->config->get('firebase.default');
Expand All @@ -243,9 +220,7 @@ public function debug_logging_can_be_configured(): void
$this->assertNotNull($property->getValue($factory));
}

/**
* @test
*/
#[Test]
public function http_client_options_can_be_configured(): void
{
$projectName = $this->app->config->get('firebase.default');
Expand All @@ -263,9 +238,7 @@ public function http_client_options_can_be_configured(): void
$this->assertSame([RetryMiddleware::class], $httpClientOptions->guzzleMiddlewares());
}

/**
* @test
*/
#[Test]
public function it_uses_the_laravel_cache_as_verifier_cache(): void
{
$projectName = $this->app->config->get('firebase.default');
Expand All @@ -276,9 +249,7 @@ public function it_uses_the_laravel_cache_as_verifier_cache(): void
$this->assertInstanceOf(CacheItemPoolInterface::class, $property->getValue($factory));
}

/**
* @test
*/
#[Test]
public function it_overrides_the_default_firestore_database(): void
{
config(['firebase.projects.app.firestore.database' => 'override-database']);
Expand All @@ -290,9 +261,7 @@ public function it_overrides_the_default_firestore_database(): void
$this->assertEquals('override-database', $property->getValue($factory)['database']);
}

/**
* @test
*/
#[Test]
public function it_uses_the_laravel_cache_as_auth_token_cache(): void
{
$projectName = $this->app->config->get('firebase.default');
Expand Down
9 changes: 3 additions & 6 deletions tests/ServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
namespace Kreait\Laravel\Firebase\Tests;

use Kreait\Firebase;
use PHPUnit\Framework\Attributes\Test;

/**
* @internal
*/
final class ServiceProviderTest extends TestCase
{
/**
* @test
*/
#[Test]
public function it_provides_components(): void
{
$this->app->config->set('firebase.projects.app.credentials', \realpath(__DIR__.'/_fixtures/service_account.json'));
Expand All @@ -27,9 +26,7 @@ public function it_provides_components(): void
$this->assertInstanceOf(Firebase\Contract\Storage::class, $this->app->make(Firebase\Contract\Storage::class));
}

/**
* @test
*/
#[Test]
public function it_does_not_provide_optional_components(): void
{
$this->expectException(\Throwable::class);
Expand Down