Perforce Chronicle 2012.2/486814
API Documentation

Category_Test_ContentSubFormTest Class Reference

Test the category content sub-form. More...

List of all members.

Public Member Functions

 testFormInit ()
 Test form initialization.

Detailed Description

Test the category content sub-form.

Copyright:
2011-2012 Perforce Software. All rights reserved
License:
Please see LICENSE.txt in top-level folder of this distribution.
Version:
2012.2/486814

Member Function Documentation

Category_Test_ContentSubFormTest::testFormInit ( )

Test form initialization.

    {
        // create some categories.
        Category_Model_Category::store('test');
        Category_Model_Category::store('test/sub1');
        Category_Model_Category::store('test/sub2');
        Category_Model_Category::store('test/sub3');
        Category_Model_Category::store('foo');
        Category_Model_Category::store('foo/bar');

        // create form and ensure it has cats.
        $form = new Category_Form_Content;

        $categories = $form->getElement('categories');
        $this->assertTrue($categories instanceof P4Cms_Form_Element_NestedCheckbox);

        $options = array(
            'foo'   => 'foo',
            'foo/'  => array(
                'foo/bar' => 'bar'
            ),
            'test'  => 'test',
            'test/' => array(
                'test/sub1' => 'sub1',
                'test/sub2' => 'sub2',
                'test/sub3' => 'sub3'
            )
        );
        $this->assertSame(
            $options,
            $categories->getMultiOptions(),
            "Expected same options in category sub-form."
        );
    }

The documentation for this class was generated from the following file: