silverstripe-userforms/tests/php/Form/UserFormTest.php

26 lines
761 B
PHP
Raw Normal View History

2015-08-17 05:30:32 +02:00
<?php
namespace SilverStripe\UserForms\Tests\Form;
use SilverStripe\CMS\Controllers\ModelAsController;
use SilverStripe\Dev\SapphireTest;
use SilverStripe\UserForms\Model\UserDefinedForm;
use SilverStripe\UserForms\Form\UserForm;
2015-08-17 05:30:32 +02:00
2016-07-21 07:53:59 +02:00
class UserFormTest extends SapphireTest
{
2017-10-16 03:32:44 +02:00
protected static $fixture_file = '../UserFormsTest.yml';
2015-08-17 05:30:32 +02:00
2016-07-21 07:53:59 +02:00
/**
* Tests that a form will not generate empty pages
*/
public function testEmptyPages()
{
$page = $this->objFromFixture(UserDefinedForm::class, 'empty-page');
2016-07-21 07:53:59 +02:00
$this->assertEquals(5, $page->Fields()->count());
$controller = ModelAsController::controller_for($page);
$form = new UserForm($controller);
$this->assertEquals(2, $form->getSteps()->count());
}
}