Skip to content

Commit c415fa4

Browse files
committed
WIP tabs test
1 parent 8b5b141 commit c415fa4

2 files changed

Lines changed: 39 additions & 3 deletions

File tree

Tests/Form/AbstractDivLayoutTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Mopa\Bundle\BootstrapBundle\Form\Extension\WidgetFormTypeExtension;
1111
use Mopa\Bundle\BootstrapBundle\Form\Extension\WidgetCollectionFormTypeExtension;
1212
use Mopa\Bundle\BootstrapBundle\Form\Extension\IconButtonExtension;
13+
use Mopa\Bundle\BootstrapBundle\Form\Type\TabType;
1314
use Mopa\Bundle\BootstrapBundle\Twig\MopaBootstrapInitializrTwigExtension;
1415
use Mopa\Bundle\BootstrapBundle\Twig\MopaBootstrapTwigExtension;
1516
use Mopa\Bundle\BootstrapBundle\Tests\FileSystemLoader;
@@ -32,6 +33,7 @@ abstract class AbstractDivLayoutTest extends FormIntegrationTestCase
3233
'form' => 'Symfony\Component\Form\Extension\Core\Type\FormType',
3334
'text' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
3435
'email' => 'Symfony\Component\Form\Extension\Core\Type\EmailType',
36+
'tab' => 'Mopa\Bundle\BootstrapBundle\Form\Type\TabType',
3537
);
3638

3739
/**
@@ -88,19 +90,20 @@ protected function setUp()
8890
*/
8991
protected function getExtensions()
9092
{
91-
return array(new PreloadedExtension(array(), array(
93+
return array(new PreloadedExtension(array(
94+
'tab' => new TabType(),
95+
), array(
9296
$this->getFormType('form') => array(
9397
$this->getHelpFormTypeExtension(),
9498
$this->getWidgetFormTypeExtension(),
9599
$this->getWidgetCollectionFormTypeExtension(),
96100
$this->getLegendFormTypeExtension(),
97101
$this->getErrorTypeFormTypeExtension(),
98102
$this->getIconButtonExtension(),
103+
$this->getTabbedFormTypeExtension(),
99104
),
100105
$this->getFormType('text') => array(
101106
),
102-
$this->getFormType('tab') => array(
103-
),
104107
)));
105108
}
106109

Tests/Form/TabbedLayoutTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<?php
2+
3+
namespace Mopa\Bundle\BootstrapBundle\Tests\Form;
4+
5+
class TabbedLayoutTest extends AbstractDivLayoutTest
6+
{
7+
public function testInlineRow()
8+
{
9+
$form = $this->factory
10+
->createNamed('form', $this->getFormType('form'))
11+
;
12+
$tab1 = $this->factory
13+
->createNamed('tab1', $this->getFormType('tab'), null, array(
14+
'auto_initialize' => false,
15+
))
16+
;
17+
$tab2 = $this->factory
18+
->createNamed('tab2', $this->getFormType('tab'), null, array(
19+
'auto_initialize' => false,
20+
))
21+
;
22+
$form->add($tab1);
23+
$form->add($tab2);
24+
$view = $form->createView();
25+
$html = $this->renderWidget($view);
26+
27+
$this->assertContains($html,
28+
'
29+
FAIL
30+
'
31+
);
32+
}
33+
}

0 commit comments

Comments
 (0)