Skip to content

Commit

Permalink
Update PHPUnit
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegamez committed Nov 24, 2024
1 parent 1ef3816 commit a3382a2
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 62 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"require-dev": {
"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
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

0 comments on commit a3382a2

Please sign in to comment.