-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
100 additions
and
17 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
12 changes: 12 additions & 0 deletions
12
tests/cases/integration/BridgeNetteDI/dic-extension-order.neon
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,12 @@ | ||
extensions: | ||
nextras.orm: Nextras\Orm\Bridges\NetteDI\OrmExtension | ||
nextras.dbal: Nextras\Dbal\Bridges\NetteDI\DbalExtension | ||
nette.cache: Nette\Bridges\CacheDI\CacheExtension(%tempDir%) | ||
|
||
nextras.orm: | ||
model: NextrasTests\Orm\Model | ||
repositoryFinder: Nextras\Orm\Bridges\NetteDI\DIRepositoryFinder | ||
|
||
services: | ||
- NextrasTests\Orm\ContentsRepository(NextrasTests\Orm\ContentsMapper()) | ||
- Nette\Caching\Cache |
34 changes: 34 additions & 0 deletions
34
tests/cases/integration/BridgeNetteDI/dic-extension-order.phpt
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 NextrasTests\Orm\Integration\BridgeNetteDI; | ||
|
||
use Nette\DI\Compiler; | ||
use Nette\DI\Container; | ||
use Nette\DI\ContainerLoader; | ||
use Nette\DI\Extensions\ExtensionsExtension; | ||
use Nextras\Orm\Model\IModel; | ||
use Tester\Assert; | ||
|
||
|
||
require_once __DIR__ . '/../../../bootstrap.php'; | ||
|
||
function buildDic($config) | ||
{ | ||
$cacheDir = TEMP_DIR . '/cache/bridge-nette-dic-extension-order'; | ||
$loader = new ContainerLoader($cacheDir); | ||
$key = __FILE__ . ':' . __LINE__ . ':' . $config; | ||
$className = $loader->load(function (Compiler $compiler) use ($config, $cacheDir) { | ||
$compiler->addExtension('extensions', new ExtensionsExtension()); | ||
$compiler->addConfig(['parameters' => ['tempDir' => $cacheDir]]); | ||
$compiler->loadConfig($config); | ||
}, $key); | ||
|
||
/** @var Container $dic */ | ||
$dic = new $className; | ||
return $dic; | ||
} | ||
|
||
$container = buildDic(__DIR__ . '/dic-extension-order.neon'); | ||
assert($container instanceof Container); | ||
|
||
Assert::true($container->findByType(IModel::class) != null); |
File renamed without changes.
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