Skip to content

Commit e5a6b9b

Browse files
committed
Add tests
1 parent 69484ec commit e5a6b9b

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
# js-phpize-phug
2+
[![Latest Stable Version](https://poser.pugx.org/js-phpize/js-phpize-phug/v/stable.png)](https://packagist.org/packages/js-phpize/js-phpize-phug)
3+
[![Build Status](https://travis-ci.org/pug-php/js-phpize-phug.svg?branch=master)](https://travis-ci.org/pug-php/js-phpize-phug)
4+
[![Code Climate](https://codeclimate.com/github/pug-php/js-phpize-phug/badges/gpa.svg)](https://codeclimate.com/github/pug-php/js-phpize-phug)
5+
[![Test Coverage](https://codeclimate.com/github/pug-php/js-phpize-phug/badges/coverage.svg)](https://codeclimate.com/github/pug-php/js-phpize-phug/coverage)
6+
[![Issue Count](https://codeclimate.com/github/pug-php/js-phpize-phug/badges/issue_count.svg)](https://codeclimate.com/github/pug-php/js-phpize-phug)
7+
[![StyleCI](https://styleci.io/repos/93831702/shield?branch=master)](https://styleci.io/repos/93831702)
8+
29
JsPhpize Phug adapter

tests/JsPhpize/JsPhpizePhugTest.php

+10
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,15 @@ public function testPlug()
1717
'<a data-foo="<?= htmlspecialchars((is_array($_pug_temp = array( \'message\' => "Hello" )) || (is_object($_pug_temp) && !method_exists($_pug_temp, "__toString")) ? json_encode($_pug_temp) : strval($_pug_temp))) ?>"></a>',
1818
$compiler->compile('a(data-foo={message: "Hello"})')
1919
);
20+
21+
self::assertSame(
22+
'<a foo="<?= (is_array($_pug_temp = $foo) || (is_object($_pug_temp) && !method_exists($_pug_temp, "__toString")) ? json_encode($_pug_temp) : strval($_pug_temp)) ?>"></a>',
23+
$compiler->compile('a(foo?!=foo)')
24+
);
25+
26+
self::assertSame(
27+
'<a foo="<?= (is_array($_pug_temp = array("foo" => "bar")[\'foo\']) || (is_object($_pug_temp) && !method_exists($_pug_temp, "__toString")) ? json_encode($_pug_temp) : strval($_pug_temp)) ?>"></a>',
28+
$compiler->compile('a(foo?!=array("foo" => "bar")[\'foo\'])')
29+
);
2030
}
2131
}

0 commit comments

Comments
 (0)