Skip to content

Commit cd658f2

Browse files
committed
Add travis
1 parent 450b09d commit cd658f2

File tree

5 files changed

+27
-68
lines changed

5 files changed

+27
-68
lines changed

.gitignore

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,8 @@
1-
# Cache and logs (Symfony2)
2-
/app/cache/*
3-
/app/logs/*
4-
!app/cache/.gitkeep
5-
!app/logs/.gitkeep
6-
7-
# Email spool folder
8-
/app/spool/*
9-
10-
# Cache, session files and logs (Symfony3)
11-
/var/cache/*
12-
/var/logs/*
13-
/var/sessions/*
14-
!var/cache/.gitkeep
15-
!var/logs/.gitkeep
16-
!var/sessions/.gitkeep
17-
18-
# Parameters
19-
/app/config/parameters.yml
20-
/app/config/parameters.ini
211

222
# Managed by Composer
23-
/app/bootstrap.php.cache
24-
/var/bootstrap.php.cache
253
/bin/*
264
!bin/console
27-
!bin/symfony_requirements
285
/vendor/
296

30-
# Assets and user uploads
31-
/web/bundles/
32-
/web/uploads/
33-
347
# PHPUnit
35-
/app/phpunit.xml
368
/phpunit.xml
37-
38-
# Build data
39-
/build/
40-
41-
# Composer PHAR
42-
/composer.phar
43-
44-
# Backup entities generated with doctrine:generate:entities command
45-
**/Entity/*~
46-
47-
# Embedded web-server pid file
48-
/.web-server-pid

.travis.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
language: php
2+
3+
php:
4+
- 7.1
5+
- 7.2
6+
7+
script:
8+
- phpunit

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
},
3232
"require-dev": {
33+
"ext-simplexml": "*",
3334
"phpunit/phpunit": "^4.0"
3435
}
3536
}

tests/CompilerTest.php

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,4 @@ public function leavesMustacheVariablesIntact()
2121

2222
$this->assertEqualHtml($html, $actual);
2323
}
24-
25-
private function createDocumentWithHtml(string $html): DOMDocument
26-
{
27-
$document = new DOMDocument();
28-
29-
@$document->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
30-
31-
return $document;
32-
}
33-
34-
private function getTemplateNode(DOMDocument $document): DOMNode
35-
{
36-
return $document->getElementsByTagName('template')->item(0);
37-
}
3824
}

tests/TestCase.php

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,43 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace Macavity\VueToTwig\Tests;
44

5+
use DOMDocument;
56

67
class TestCase extends \PHPUnit\Framework\TestCase
78
{
8-
/**
9-
* @param string $expectedResult
10-
* @param string $result
11-
*/
12-
protected function assertEqualHtml( $expectedResult, $result ) {
9+
protected function assertEqualHtml( $expectedResult, $result ): void
10+
{
1311
$expectedResult = $this->normalizeHtml( $expectedResult );
1412
$result = $this->normalizeHtml( $result );
1513

1614
$this->assertEquals( $expectedResult, $result );
1715
}
1816

19-
/**
20-
* @param string $html
21-
*
22-
* @return string HTML
23-
*/
24-
protected function normalizeHtml( $html ) {
17+
protected function createDocumentWithHtml(string $html): DOMDocument
18+
{
19+
$document = new DOMDocument();
20+
@$document->loadHTML($html, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
21+
22+
return $document;
23+
}
24+
25+
protected function normalizeHtml( $html ): string
26+
{
2527
$html = preg_replace( '/<!--.*?-->/', '', $html );
2628
$html = preg_replace( '/\s+/', ' ', $html );
29+
2730
// Trim node text
2831
$html = str_replace( '> ', ">", $html );
2932
$html = str_replace( ' <', "<", $html );
33+
3034
// Each tag (open and close) on a new line
3135
$html = str_replace( '>', ">\n", $html );
3236
$html = str_replace( '<', "\n<", $html );
37+
3338
// Remove duplicated new lines
3439
$html = str_replace( "\n\n", "\n", $html );
3540

36-
$html = trim( $html );
37-
return $html;
41+
return trim($html);
3842
}
3943
}

0 commit comments

Comments
 (0)