Skip to content
This repository was archived by the owner on Apr 12, 2020. It is now read-only.

Commit 932a95e

Browse files
author
alexandresalome
committed
tests + cleanup
1 parent 5fc34ba commit 932a95e

File tree

3 files changed

+30
-37
lines changed

3 files changed

+30
-37
lines changed

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ GitonomyGitBundle
33

44
This bundle provides git features for your twig-based application.
55

6-
Please read `the documentation <Resources/doc/index.rst>`.
6+
Please read `the documentation <Resources/doc/index.rst>`_.

Resources/views/default_theme.html.twig

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -225,42 +225,6 @@
225225

226226
{# References #}
227227

228-
{% block branches %}
229-
{% spaceless %}
230-
<ul>
231-
{% for branch in branches %}
232-
<li>
233-
<a href="{{ git_url(branch) }}">
234-
<strong>{{ branch.name }}</strong>
235-
</a>
236-
<small>
237-
{{ git_author(branch.commit) }}
238-
{{ branch.commit.authorDate.format('d/m/Y') }}
239-
</small>
240-
</li>
241-
{% endfor %}
242-
</ul>
243-
{% endspaceless %}
244-
{% endblock %}
245-
246-
{% block tags %}
247-
{% spaceless %}
248-
<ul>
249-
{% for tag in tags %}
250-
<li>
251-
<a href="{{ git_url(tag) }}">
252-
<strong>{{ tag.name }}</strong>
253-
</a>
254-
<small>
255-
{{ git_author(tag.commit) }}
256-
{{ tag.commit.authorDate.format('d/m/Y') }}
257-
</small>
258-
</li>
259-
{% endfor %}
260-
</ul>
261-
{% endspaceless %}
262-
{% endblock %}
263-
264228
{% block git_label_revision %}
265229
{% spaceless %}
266230
{% if revision is git_reference %}

Tests/Twig/RenderingTest.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,39 @@
1313
class RenderingTest extends AbstractTest
1414
{
1515
private static $templates = array(
16+
'diff' => '{{ git_diff(diff) }}',
17+
'log' => '{{ git_log(log) }}',
1618
'label_tag' => '{{ git_label(tag) }}',
1719
'label_branch' => '{{ git_label(branch) }}',
1820
);
1921

22+
public function testRenderingOk()
23+
{
24+
$repository = self::getFoobarRepository();
25+
26+
$commits = array(
27+
self::LONGFILE_COMMIT,
28+
self::BEFORE_LONGFILE_COMMIT,
29+
self::LONGMESSAGE_COMMIT,
30+
self::INITIAL_COMMIT,
31+
self::MERGE_COMMIT,
32+
self::ENCODING_COMMIT,
33+
);
34+
35+
foreach ($commits as $hash) {
36+
$commit = $repository->getCommit($hash);
37+
$diff = $commit->getDiff();
38+
$log = $repository->getLog($hash.'..'.self::INITIAL_COMMIT);
39+
40+
$crawler = self::render('diff', array('diff' => $diff));
41+
$this->assertCount(1, $crawler->filter('div.file-wrapper'));
42+
43+
$crawler = self::render('log', array('log' => $log));
44+
$this->assertCount(1, $crawler->filter('table'));
45+
46+
}
47+
}
48+
2049
public function testLabel_Tag()
2150
{
2251
$repository = self::getFoobarRepository();

0 commit comments

Comments
 (0)