Skip to content

Commit

Permalink
Merge pull request #394 from dkisselev/integration-tests
Browse files Browse the repository at this point in the history
Add Twig integration tests for common methods
  • Loading branch information
Florian Eckerstorfer committed Nov 4, 2015
2 parents 55ae969 + 1abe864 commit a275992
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Tests/Twig/Fixtures/functions/badge.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--TEST--
"badge" function
--TEMPLATE--
{{ badge('42') }}
--DATA--
return array();
--EXPECT--
<span class="badge">42</span>
8 changes: 8 additions & 0 deletions Tests/Twig/Fixtures/functions/icon.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
--TEST--
"icon" function
--TEMPLATE--
{{ icon('camera') }}
--DATA--
return array();
--EXPECT--
<span class="fa fa-camera"></span>
16 changes: 16 additions & 0 deletions Tests/Twig/Fixtures/functions/label.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--TEST--
"label" functions
--TEMPLATE--
{{ label('Default') }}
{{ label_success('Success') }}
{{ label_primary('Primary') }}
{{ label_warning('Warning') }}
{{ label_danger('Danger') }}
--DATA--
return array();
--EXPECT--
<span class="label label-default">Default</span>
<span class="label label-success">Success</span>
<span class="label label-primary">Primary</span>
<span class="label label-warning">Warning</span>
<span class="label label-danger">Danger</span>
26 changes: 26 additions & 0 deletions Tests/Twig/IntegrationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

use Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapBadgeExtension;
use Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapButtonExtension;
use Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapFormExtension;
use Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapIconExtension;
use Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapLabelExtension;

class Project_Tests_IntegrationTest extends Twig_Test_IntegrationTestCase
{
public function getExtensions()
{
return array(
new BootstrapBadgeExtension(),
new BootstrapButtonExtension(new BootstrapIconExtension("fa")),
new BootstrapFormExtension(),
new BootstrapIconExtension("fa"),
new BootstrapLabelExtension(),
);
}

public function getFixturesDir()
{
return dirname(__FILE__).'/Fixtures/';
}
}

0 comments on commit a275992

Please sign in to comment.