Skip to content

Commit

Permalink
Update phpunit, remove deprecated docs from test classes
Browse files Browse the repository at this point in the history
  • Loading branch information
MohammedElattar committed Mar 13, 2024
1 parent 7021b33 commit 18aee17
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 98 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
/composer.lock
/google-service-account.json
/phpunit.xml
.phpunit.cache
45 changes: 19 additions & 26 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
<?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"
>
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>

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

<php>
<ini name="date.timezone" value="UTC"/>
<server name="APP_ENV" value="testing"/>
<server name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
</php>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd" beStrictAboutOutputDuringTests="true" colors="true" cacheDirectory=".phpunit.cache">
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
<ini name="date.timezone" value="UTC"/>
<server name="APP_ENV" value="testing"/>
<server name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
</php>
<source>
<include>
<directory suffix=".php">src</directory>
</include>
<exclude>
<directory>src/Facades</directory>
</exclude>
</source>
</phpunit>
28 changes: 28 additions & 0 deletions phpunit.xml.dist.bak
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?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"
>
<testsuites>
<testsuite name="Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>

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

<php>
<ini name="date.timezone" value="UTC"/>
<server name="APP_ENV" value="testing"/>
<server name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
</php>
</phpunit>
80 changes: 16 additions & 64 deletions tests/FirebaseProjectManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@ protected function defineEnvironment($app): void
$app['config']->set('firebase.projects.app.credentials', __DIR__.'/_fixtures/service_account.json');
}

/**
* @test
*/
public function a_project_configuration_has_to_exist(): void
public function test_a_project_configuration_has_to_exist(): void
{
$manager = $this->app->make(FirebaseProjectManager::class);

Expand All @@ -36,10 +33,7 @@ public function a_project_configuration_has_to_exist(): void
$this->getAccessibleMethod($manager, 'configuration')->invoke($manager, $projectName);
}

/**
* @test
*/
public function a_default_project_can_be_set(): void
public function test_a_default_project_can_be_set(): void
{
$manager = $this->app->make(FirebaseProjectManager::class);

Expand All @@ -51,10 +45,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
*/
public function calls_are_passed_to_default_project(): void
public function test_calls_are_passed_to_default_project(): void
{
$manager = $this->app->make(FirebaseProjectManager::class);

Expand All @@ -63,10 +54,7 @@ public function calls_are_passed_to_default_project(): void
$this->assertSame($manager->project($projectName)->auth(), $manager->auth());
}

/**
* @test
*/
public function credentials_can_be_configured_using_a_json_file(): void
public function test_credentials_can_be_configured_using_a_json_file(): void
{
// Reference credentials
$credentialsPath = \realpath(__DIR__.'/_fixtures/service_account.json');
Expand All @@ -84,10 +72,7 @@ public function credentials_can_be_configured_using_a_json_file(): void
$this->assertSame($credentials, $serviceAccount);
}

/**
* @test
*/
public function json_file_credentials_can_be_used_using_the_deprecated_configuration_entry(): void
public function test_json_file_credentials_can_be_used_using_the_deprecated_configuration_entry(): void
{
// Reference credentials
$credentialsPath = \realpath(__DIR__.'/_fixtures/service_account.json');
Expand All @@ -105,10 +90,7 @@ public function json_file_credentials_can_be_used_using_the_deprecated_configura
$this->assertSame($credentials, $serviceAccount);
}

/**
* @test
*/
public function credentials_can_be_configured_using_an_array(): void
public function test_credentials_can_be_configured_using_an_array(): void
{
// Set configuration and retrieve project
$projectName = 'app';
Expand All @@ -133,10 +115,7 @@ public function credentials_can_be_configured_using_an_array(): void
$this->assertSame($credentials, $serviceAccount);
}

/**
* @test
*/
public function projects_can_have_different_credentials(): void
public function test_projects_can_have_different_credentials(): void
{
// Reference credentials
$credentialsPath = \realpath(__DIR__.'/_fixtures/service_account.json');
Expand Down Expand Up @@ -165,10 +144,7 @@ public function projects_can_have_different_credentials(): void
$this->assertSame($secondCredentials, $secondServiceAccount);
}

/**
* @test
*/
public function the_realtime_database_url_can_be_configured(): void
public function test_the_realtime_database_url_can_be_configured(): void
{
$projectName = $this->app->config->get('firebase.default');
$this->app->config->set('firebase.projects.'.$projectName.'.database.url', $url = 'https://domain.tld');
Expand All @@ -181,10 +157,7 @@ public function the_realtime_database_url_can_be_configured(): void
$this->assertSame($url, (string) $property->getValue($database));
}

/**
* @test
*/
public function the_dynamic_links_default_domain_can_be_configured(): void
public function test_the_dynamic_links_default_domain_can_be_configured(): void
{
$projectName = $this->app->config->get('firebase.default');
$this->app->config->set('firebase.projects.'.$projectName.'.dynamic_links.default_domain', $domain = 'https://domain.tld');
Expand All @@ -198,10 +171,7 @@ public function the_dynamic_links_default_domain_can_be_configured(): void
$this->assertSame($domain, $configuredDomain);
}

/**
* @test
*/
public function the_storage_default_bucket_can_be_configured(): void
public function test_the_storage_default_bucket_can_be_configured(): void
{
$projectName = $this->app->config->get('firebase.default');
$this->app->config->set('firebase.projects.'.$projectName.'.storage.default_bucket', $name = 'my-bucket');
Expand All @@ -213,10 +183,7 @@ public function the_storage_default_bucket_can_be_configured(): void
$this->assertSame($name, $property->getValue($storage));
}

/**
* @test
*/
public function logging_can_be_configured(): void
public function test_logging_can_be_configured(): void
{
$projectName = $this->app->config->get('firebase.default');
$this->app->config->set('firebase.projects.'.$projectName.'.logging.http_log_channel', 'stack');
Expand All @@ -228,10 +195,7 @@ public function logging_can_be_configured(): void
$this->assertNotNull($property->getValue($factory));
}

/**
* @test
*/
public function debug_logging_can_be_configured(): void
public function test_debug_logging_can_be_configured(): void
{
$projectName = $this->app->config->get('firebase.default');
$this->app->config->set('firebase.projects.'.$projectName.'.logging.http_debug_log_channel', 'stack');
Expand All @@ -243,10 +207,7 @@ public function debug_logging_can_be_configured(): void
$this->assertNotNull($property->getValue($factory));
}

/**
* @test
*/
public function http_client_options_can_be_configured(): void
public function test_http_client_options_can_be_configured(): void
{
$projectName = $this->app->config->get('firebase.default');
$this->app->config->set('firebase.projects.'.$projectName.'.http_client_options.proxy', 'proxy.domain.tld');
Expand All @@ -263,10 +224,7 @@ public function http_client_options_can_be_configured(): void
$this->assertSame([RetryMiddleware::class], $httpClientOptions->guzzleMiddlewares());
}

/**
* @test
*/
public function it_uses_the_laravel_cache_as_verifier_cache(): void
public function test_it_uses_the_laravel_cache_as_verifier_cache(): void
{
$projectName = $this->app->config->get('firebase.default');
$factory = $this->factoryForProject($projectName);
Expand All @@ -276,10 +234,7 @@ public function it_uses_the_laravel_cache_as_verifier_cache(): void
$this->assertInstanceOf(CacheItemPoolInterface::class, $property->getValue($factory));
}

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

/**
* @test
*/
public function it_uses_the_laravel_cache_as_auth_token_cache(): void
public function test_it_uses_the_laravel_cache_as_auth_token_cache(): void
{
$projectName = $this->app->config->get('firebase.default');
$factory = $this->factoryForProject($projectName);
Expand Down
10 changes: 2 additions & 8 deletions tests/ServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
*/
final class ServiceProviderTest extends TestCase
{
/**
* @test
*/
public function it_provides_components(): void
public function test_it_provides_components(): void
{
$this->app->config->set('firebase.projects.app.credentials', \realpath(__DIR__.'/_fixtures/service_account.json'));

Expand All @@ -27,10 +24,7 @@ public function it_provides_components(): void
$this->assertInstanceOf(Firebase\Contract\Storage::class, $this->app->make(Firebase\Contract\Storage::class));
}

/**
* @test
*/
public function it_does_not_provide_optional_components(): void
public function test_it_does_not_provide_optional_components(): void
{
$this->expectException(\Throwable::class);
$this->expectExceptionMessageMatches('/unable/i');
Expand Down

0 comments on commit 18aee17

Please sign in to comment.