Skip to content

Commit

Permalink
WIP tabs test
Browse files Browse the repository at this point in the history
  • Loading branch information
carlo1138 committed Jun 11, 2016
1 parent 8b5b141 commit c415fa4
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Tests/Form/AbstractDivLayoutTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Mopa\Bundle\BootstrapBundle\Form\Extension\WidgetFormTypeExtension;
use Mopa\Bundle\BootstrapBundle\Form\Extension\WidgetCollectionFormTypeExtension;
use Mopa\Bundle\BootstrapBundle\Form\Extension\IconButtonExtension;
use Mopa\Bundle\BootstrapBundle\Form\Type\TabType;
use Mopa\Bundle\BootstrapBundle\Twig\MopaBootstrapInitializrTwigExtension;
use Mopa\Bundle\BootstrapBundle\Twig\MopaBootstrapTwigExtension;
use Mopa\Bundle\BootstrapBundle\Tests\FileSystemLoader;
Expand All @@ -32,6 +33,7 @@ abstract class AbstractDivLayoutTest extends FormIntegrationTestCase
'form' => 'Symfony\Component\Form\Extension\Core\Type\FormType',
'text' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'email' => 'Symfony\Component\Form\Extension\Core\Type\EmailType',
'tab' => 'Mopa\Bundle\BootstrapBundle\Form\Type\TabType',
);

/**
Expand Down Expand Up @@ -88,19 +90,20 @@ protected function setUp()
*/
protected function getExtensions()
{
return array(new PreloadedExtension(array(), array(
return array(new PreloadedExtension(array(
'tab' => new TabType(),
), array(
$this->getFormType('form') => array(
$this->getHelpFormTypeExtension(),
$this->getWidgetFormTypeExtension(),
$this->getWidgetCollectionFormTypeExtension(),
$this->getLegendFormTypeExtension(),
$this->getErrorTypeFormTypeExtension(),
$this->getIconButtonExtension(),
$this->getTabbedFormTypeExtension(),
),
$this->getFormType('text') => array(
),
$this->getFormType('tab') => array(
),
)));
}

Expand Down
33 changes: 33 additions & 0 deletions Tests/Form/TabbedLayoutTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Mopa\Bundle\BootstrapBundle\Tests\Form;

class TabbedLayoutTest extends AbstractDivLayoutTest
{
public function testInlineRow()
{
$form = $this->factory
->createNamed('form', $this->getFormType('form'))
;
$tab1 = $this->factory
->createNamed('tab1', $this->getFormType('tab'), null, array(
'auto_initialize' => false,
))
;
$tab2 = $this->factory
->createNamed('tab2', $this->getFormType('tab'), null, array(
'auto_initialize' => false,
))
;
$form->add($tab1);
$form->add($tab2);
$view = $form->createView();
$html = $this->renderWidget($view);

$this->assertContains($html,
'
FAIL
'
);
}
}

0 comments on commit c415fa4

Please sign in to comment.