2015-08-17 05:30:32 +02:00
|
|
|
<?php
|
|
|
|
|
2017-08-15 23:31:47 +02:00
|
|
|
namespace SilverStripe\UserForms\Tests\Form;
|
2017-08-09 01:55:09 +02:00
|
|
|
|
|
|
|
use SilverStripe\CMS\Controllers\ModelAsController;
|
|
|
|
use SilverStripe\Dev\SapphireTest;
|
2017-08-11 02:20:12 +02:00
|
|
|
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()
|
|
|
|
{
|
2017-08-09 01:55:09 +02:00
|
|
|
$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());
|
|
|
|
}
|
|
|
|
}
|