Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit13b3ad0

Browse files
committed
improve full twig compatibility mode
1 parentab84a6e commit13b3ad0

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

‎src/Extension/FullCompatibilityTwigExtension.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<?php
22
namespaceGoetas\Twital\Extension;
33

4+
useGoetas\Twital\EventSubscriber\CustomNamespaceSubscriber;
45
useGoetas\Twital\EventSubscriber\FixTwigExpressionSubscriber;
6+
useGoetas\Twital\Twital;
57

68
/**
79
*
@@ -14,6 +16,9 @@ public function getSubscribers()
1416
{
1517
returnarray(
1618
newFixTwigExpressionSubscriber(),
19+
newCustomNamespaceSubscriber(array(
20+
't' => Twital::NS
21+
)),
1722
);
1823
}
1924
}

‎tests/Tests/FullCompatibilityTwigTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ public function testListenerPriority()
3939
/**
4040
* @dataProvider getData
4141
*/
42-
publicfunctiontestHTML5SourceAdapter($source)
42+
publicfunctiontestHTML5SourceAdapter($source,$expected =null)
4343
{
4444
$sourceAdapter =newHTML5Adapter();
4545

4646
$compiled =$this->twital->compile($sourceAdapter,$source);
47-
$this->assertEquals($source,$compiled,'PRE:'.$this->templateSubscriber->preLoadTemplate."\n\nPOST:".$this->templateSubscriber->postDumpTemplate);
47+
$this->assertEquals($expected !==null ?$expected :$source,$compiled,'PRE:'.$this->templateSubscriber->preLoadTemplate."\n\nPOST:".$this->templateSubscriber->postDumpTemplate);
4848
}
4949

5050
publicfunctiongetData()
@@ -76,7 +76,7 @@ public function getData()
7676

7777
array(file_get_contents(__DIR__.'/templates/web_profiler_js.html.twig')),
7878
array(file_get_contents(__DIR__.'/templates/logger.html.twig')),
79-
//array(file_get_contents(__DIR__.'/templates/widget-header.twig')),
79+
array('test <div t:if="foo">{{ foo }}</div> test <div t:if="bar">{{ bar }}</div> test','test {% if foo %}<div>{{ foo }}</div>{% endif %} test {% if bar %}<div>{{ bar }}</div>{% endif %} test'),
8080
);
8181
}
8282
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp