-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #643 from TomHAnderson/feature/service-provider-test
Feature/service provider test
- Loading branch information
Showing
6 changed files
with
105 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,4 +116,4 @@ | |
"@php vendor/bin/phpstan analyse --verbose --ansi" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
tests/Feature/DoctrineServiceProviderCustomFunctionsTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace LaravelDoctrineTest\ORM\Feature; | ||
|
||
use Doctrine\Persistence\ManagerRegistry; | ||
use Illuminate\Config\Repository; | ||
use Illuminate\Foundation\Application; | ||
use LaravelDoctrineTest\ORM\TestCase; | ||
|
||
use function tap; | ||
|
||
class DoctrineServiceProviderCustomFunctionsTest extends TestCase | ||
{ | ||
/** | ||
* @param Application $app | ||
* phpcs:disable | ||
*/ | ||
protected function defineEnvironment($app): void | ||
{ | ||
// Setup default database to use sqlite :memory: | ||
tap($app['config'], static function (Repository $config): void { | ||
// Custom functions are tested in the extensions repository | ||
}); | ||
} | ||
|
||
public function testRegistryIsRegistered(): void | ||
{ | ||
$registry = $this->app->get('registry'); | ||
|
||
$this->assertInstanceOf( | ||
ManagerRegistry::class, | ||
$registry, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace LaravelDoctrineTest\ORM\Feature; | ||
|
||
use Illuminate\Config\Repository; | ||
use Illuminate\Foundation\Application; | ||
use LaravelDoctrineTest\ORM\TestCase; | ||
|
||
use function tap; | ||
|
||
class DoctrineServiceProviderExtensionTest extends TestCase | ||
{ | ||
/** | ||
* @param Application $app | ||
* phpcs:disable | ||
*/ | ||
protected function defineEnvironment($app): void | ||
{ | ||
// Setup default database to use sqlite :memory: | ||
tap($app['config'], static function (Repository $config): void { | ||
}); | ||
} | ||
|
||
public function testExtensions(): void | ||
{ | ||
$registry = $this->app->get('registry'); | ||
|
||
$this->assertTrue(true); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
tests/Feature/DoctrineServiceProviderInvalidExtensionTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace LaravelDoctrineTest\ORM\Feature; | ||
|
||
use Illuminate\Config\Repository; | ||
use Illuminate\Foundation\Application; | ||
use LaravelDoctrine\ORM\Exceptions\ExtensionNotFound; | ||
use LaravelDoctrineTest\ORM\TestCase; | ||
|
||
use function tap; | ||
|
||
class DoctrineServiceProviderInvalidExtensionTest extends TestCase | ||
{ | ||
/** | ||
* @param Application $app | ||
* phpcs:disable | ||
*/ | ||
protected function defineEnvironment($app): void | ||
{ | ||
// Setup default database to use sqlite :memory: | ||
tap($app['config'], static function (Repository $config): void { | ||
$config->set('doctrine.extensions', ['invalid' => 'InvalalidExtension']); | ||
}); | ||
} | ||
|
||
public function testInvalidException(): void | ||
{ | ||
$this->expectException(ExtensionNotFound::class); | ||
|
||
$registry = $this->app->get('registry'); | ||
} | ||
} |