Skip to content

Commit 0cdccef

Browse files
committed
tests: compatible with master Latte & DI
1 parent 0dd5571 commit 0cdccef

10 files changed

+31
-31
lines changed

tests/Bridges.DI/ApplicationExtension.basic.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test(function () {
2121
$builder->addDefinition('myHttpRequest')->setFactory(Nette\Http\Request::class, [new DI\Statement(Nette\Http\UrlScript::class)]);
2222
$builder->addDefinition('myHttpResponse')->setClass(Nette\Http\Response::class);
2323

24-
$code = $compiler->compile([], 'Container1');
24+
$code = $compiler->setClassName('Container1')->compile();
2525
eval($code);
2626

2727
$container = new Container1;

tests/Bridges.DI/ApplicationExtension.invalidLink.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ test(function () {
3535
presenter: Presenter1
3636
');
3737
$compiler->addExtension('application', new ApplicationExtension(TRUE));
38-
$code = $compiler->compile(NULL, 'Container4');
38+
$code = $compiler->setClassName('Container4')->compile();
3939
eval($code);
4040

4141
$container = new Container4;
@@ -55,7 +55,7 @@ test(function () {
5555
presenter: Presenter1
5656
');
5757
$compiler->addExtension('application', new ApplicationExtension(TRUE));
58-
$code = $compiler->compile(NULL, 'Container5');
58+
$code = $compiler->setClassName('Container5')->compile();
5959
eval($code);
6060

6161
$container = new Container5;
@@ -75,7 +75,7 @@ test(function () {
7575
presenter: Presenter1
7676
');
7777
$compiler->addExtension('application', new ApplicationExtension(FALSE));
78-
$code = $compiler->compile(NULL, 'Container6');
78+
$code = $compiler->setClassName('Container6')->compile();
7979
eval($code);
8080

8181
$container = new Container6;
@@ -95,7 +95,7 @@ test(function () {
9595
presenter: Presenter1
9696
');
9797
$compiler->addExtension('application', new ApplicationExtension(FALSE));
98-
$code = $compiler->compile(NULL, 'Container7');
98+
$code = $compiler->setClassName('Container7')->compile();
9999
eval($code);
100100

101101
$container = new Container7;

tests/Bridges.DI/ApplicationExtension.scan.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ test(function () {
2121
$builder->addDefinition('myRouter')->setClass(Nette\Application\Routers\SimpleRouter::class);
2222
$builder->addDefinition('myHttpRequest')->setFactory(Nette\Http\Request::class, [new DI\Statement(Nette\Http\UrlScript::class)]);
2323
$builder->addDefinition('myHttpResponse')->setClass(Nette\Http\Response::class);
24-
$code = $compiler->compile([], 'Container1');
24+
$code = $compiler->setClassName('Container1')->compile();
2525
eval($code);
2626

2727
$container = new Container1;
@@ -40,11 +40,11 @@ test(function () {
4040
$builder->addDefinition('myRouter')->setClass(Nette\Application\Routers\SimpleRouter::class);
4141
$builder->addDefinition('myHttpRequest')->setFactory(Nette\Http\Request::class, [new DI\Statement(Nette\Http\UrlScript::class)]);
4242
$builder->addDefinition('myHttpResponse')->setClass(Nette\Http\Response::class);
43-
$code = $compiler->compile([
43+
$code = $compiler->addConfig([
4444
'application' => [
4545
'scanDirs' => [__DIR__ . '/files'],
4646
],
47-
], 'Container2');
47+
])->setClassName('Container2')->compile();
4848
eval($code);
4949

5050
$container = new Container2;
@@ -71,7 +71,7 @@ test(function () {
7171
setup:
7272
- setView(test)
7373
', 'neon'));
74-
$code = $compiler->compile($config, 'Container3');
74+
$code = $compiler->addConfig($config)->setClassName('Container3')->compile();
7575
eval($code);
7676

7777
$container = new Container3;

tests/Bridges.DI/LatteExtension.basic.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ latte:
7474
$compiler = new DI\Compiler;
7575
$compiler->addExtension('latte', new Nette\Bridges\ApplicationDI\LatteExtension(NULL, FALSE));
7676
$compiler->addExtension('another', new AnotherExtension);
77-
$code = $compiler->compile($config, 'Container');
77+
$code = $compiler->addConfig($config)->compile();
7878
eval($code);
7979

8080
$container = new Container;

tests/Bridges.DI/RoutingExtension.basic.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ test(function () {
2323

2424
$compiler = new DI\Compiler;
2525
$compiler->addExtension('routing', new RoutingExtension(FALSE));
26-
$code = $compiler->compile($config, 'Container1');
26+
$code = $compiler->addConfig($config)->compile();
2727
eval($code);
2828

29-
$container = new Container1;
29+
$container = new Container;
3030
$router = $container->getService('router');
3131
Assert::type(Nette\Application\Routers\RouteList::class, $router);
3232
Assert::count(2, $router);

tests/Bridges.DI/RoutingExtension.cache.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ test(function () {
3939

4040
$compiler = new DI\Compiler;
4141
$compiler->addExtension('routing', new RoutingExtension(FALSE));
42-
$code = $compiler->compile($config, 'Container1');
42+
$code = $compiler->addConfig($config)->setClassName('Container1')->compile();
4343
eval($code);
4444

4545
$container = new Container1;
@@ -60,7 +60,7 @@ test(function () {
6060

6161
$compiler = new DI\Compiler;
6262
$compiler->addExtension('routing', new RoutingExtension(FALSE));
63-
$code = $compiler->compile($config, 'Container2');
63+
$code = $compiler->addConfig($config)->setClassName('Container2')->compile();
6464
eval($code);
6565

6666
$container = new Container2;
@@ -88,5 +88,5 @@ Assert::exception(function () {
8888

8989
$compiler = new DI\Compiler;
9090
$compiler->addExtension('routing', new RoutingExtension(FALSE));
91-
$compiler->compile($config, 'Container3');
91+
$code = $compiler->addConfig($config)->setClassName('Container3')->compile();
9292
}, Nette\DI\ServiceCreationException::class, 'Unable to cache router due to error: %a%');

tests/Bridges.Latte/expected/UIMacros.dynamicsnippets.alt.phtml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ class Template%a% extends Latte\Template
4545
$iterations = 0;
4646
%a%
4747
foreach (array(1,2,3) as $id) {
48-
?> <div<?php echo ' id="' . ($this->local->dynSnippetId = $_control->getSnippetId("inner-$id")) . '"' ?>>
49-
<?php ob_start() ?> #<?php echo LFilters::escapeHtml($id) ?>
48+
?> <div<?php echo ' id="' . ($this->global->dynSnippetId = $_control->getSnippetId("inner-$id")) . '"' ?>>
49+
<?php ob_start() ?> #<?php echo LR\Filters::escapeHtml($id) ?>
5050

51-
<?php $this->local->dynSnippets[$this->local->dynSnippetId] = ob_get_flush() ?> </div>
51+
<?php $this->global->dynSnippets[$this->global->dynSnippetId] = ob_get_flush() ?> </div>
5252
<?php
5353
$iterations++;
5454
}
5555
?> <?php
56-
if (isset($this->local->dynSnippets)) return $this->local->dynSnippets;
56+
if (isset($this->global->dynSnippets)) return $this->global->dynSnippets;
5757

5858
}
5959

@@ -66,15 +66,15 @@ class Template%a% extends Latte\Template
6666
$iterations = 0;
6767
%a%
6868
foreach (array(1,2,3) as $id) {
69-
?> <div<?php echo ' id="' . ($this->local->dynSnippetId = $_control->getSnippetId("inner-$id")) . '"' ?>>
70-
<?php ob_start() ?> #<?php echo LFilters::escapeHtml($id) ?>
69+
?> <div<?php echo ' id="' . ($this->global->dynSnippetId = $_control->getSnippetId("inner-$id")) . '"' ?>>
70+
<?php ob_start() ?> #<?php echo LR\Filters::escapeHtml($id) ?>
7171

72-
<?php $this->local->dynSnippets[$this->local->dynSnippetId] = ob_get_flush() ?> </div>
72+
<?php $this->global->dynSnippets[$this->global->dynSnippetId] = ob_get_flush() ?> </div>
7373
<?php
7474
$iterations++;
7575
}
7676
?> <?php
77-
if (isset($this->local->dynSnippets)) return $this->local->dynSnippets;
77+
if (isset($this->global->dynSnippets)) return $this->global->dynSnippets;
7878

7979
}
8080

tests/Bridges.Latte/expected/UIMacros.dynamicsnippets.phtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ class Template%a% extends Latte\Template
4141
$iterations = 0;
4242
%a%
4343
foreach (array(1,2,3) as $id) {
44-
?> <div id="<?php echo $this->local->dynSnippetId = $_control->getSnippetId("inner-$id") ?>"><?php ob_start() ?>
44+
?> <div id="<?php echo $this->global->dynSnippetId = $_control->getSnippetId("inner-$id") ?>"><?php ob_start() ?>
4545

46-
#<?php echo LFilters::escapeHtml($id) ?>
46+
#<?php echo LR\Filters::escapeHtml($id) ?>
4747

48-
<?php $this->local->dynSnippets[$this->local->dynSnippetId] = ob_get_flush() ?></div><?php
48+
<?php $this->global->dynSnippets[$this->global->dynSnippetId] = ob_get_flush() ?></div><?php
4949
$iterations++;
5050
}
5151
?> <?php
52-
if (isset($this->local->dynSnippets)) return $this->local->dynSnippets;
52+
if (isset($this->global->dynSnippets)) return $this->global->dynSnippets;
5353

5454
}
5555

tests/Bridges.Latte/expected/UIMacros.snippet.alt.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class Template%a% extends Latte\Template
3232
call_user_func(reset($this->blockQueue['_inner']), $this->params);
3333
?> </div>
3434

35-
<div class="<?php echo LFilters::escapeHtmlAttr('class') ?>"<?php echo ' id="' . $_control->getSnippetId('gallery') . '"' ?>><?php
35+
<div class="<?php echo LR\Filters::escapeHtmlAttr('class') ?>"<?php echo ' id="' . $_control->getSnippetId('gallery') . '"' ?>><?php
3636
call_user_func(reset($this->blockQueue['_gallery']), $this->params) ?>
3737
</div>
3838
<?php

tests/Bridges.Latte/expected/UIMacros.snippet4.phtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,17 @@ begin
6464
?>
6565
end
6666
<?php
67-
if (isset($this->local->dynSnippets)) return $this->local->dynSnippets;
67+
if (isset($this->global->dynSnippets)) return $this->global->dynSnippets;
6868

6969
}
7070

7171

7272
function blockBlock2($_args)
7373
{
7474
extract($_args);
75-
?><div<?php echo ' id="' . ($this->local->dynSnippetId = $_control->getSnippetId("inner-$id")) . '"' ?>>
75+
?><div<?php echo ' id="' . ($this->global->dynSnippetId = $_control->getSnippetId("inner-$id")) . '"' ?>>
7676
<?php ob_start() ?> dynamic
77-
<?php $this->local->dynSnippets[$this->local->dynSnippetId] = ob_get_flush() ?></div>
77+
<?php $this->global->dynSnippets[$this->global->dynSnippetId] = ob_get_flush() ?></div>
7878
<?php
7979

8080
}

0 commit comments

Comments
 (0)