setTreeIconMapping() public method

public setTreeIconMapping ( TreeIconMapping $treeIconMapping = null )
$treeIconMapping TreeIconMapping
コード例 #1
0
ファイル: BundleConfigTest.php プロジェクト: jarves/jarves
    public function testObjectSmall()
    {
        $xml = '<object id="View">
  <label>Template View</label>
  <desc>Template views</desc>
  <storageService>\\Admin\\ObjectView</storageService>
  <labelField>name</labelField>
  <nested>true</nested>
  <treeIconMapping>
    <icon id="dir">#icon-folder-4</icon>
  </treeIconMapping>
  <fields>
    <field id="path" type="text" primaryKey="true">
      <label>Path</label>
    </field>
    <field id="name" type="text">
      <label>File name</label>
    </field>
  </fields>
</object>';
        $arrayObject = new Object(array('id' => 'View', 'label' => 'Template View', 'desc' => 'Template views', 'storageService' => '\\Admin\\ObjectView', 'labelField' => 'name', 'nested' => true, 'treeIconMapping' => array('dir' => '#icon-folder-4'), 'fields' => array('path' => array('id' => 'path', 'label' => 'Path', 'type' => 'text', 'primaryKey' => true), 'name' => array('id' => 'name', 'label' => 'File name', 'type' => 'text'))), $this->getJarves());
        $xmlObject = new Object($xml, $this->getJarves());
        $object = new Object(null, $this->getJarves());
        $object->setId('View');
        $object->setLabel('Template View');
        $object->setDesc('Template views');
        $object->setLabelField('name');
        $object->setNested(true);
        $object->setStorageService('\\Admin\\ObjectView');
        $treeIconMapping = new TreeIconMapping(null, $this->getJarves());
        $treeIconMapping->setOption('dir', '#icon-folder-4');
        $object->setTreeIconMapping($treeIconMapping);
        $field1 = new Field(null, $this->getJarves());
        $field1->setId('path');
        $field1->setPrimaryKey(true);
        $field1->setLabel('Path');
        $field1->setType('text');
        $field2 = new Field(null, $this->getJarves());
        $field2->setId('name');
        $field2->setLabel('File name');
        $field2->setType('text');
        $object->setFields(array($field1, $field2));
        $this->assertEquals($xml, $object->toXml());
        $this->assertEquals($xmlObject->toXml(), $object->toXml());
        $this->assertEquals($xml, $xmlObject->toXml());
        $this->assertEquals($xmlObject->toArray(), $object->toArray());
        $this->assertEquals($xmlObject->toArray(), $arrayObject->toArray());
        $this->assertEquals($xmlObject->toXml(), $arrayObject->toXml());
        $this->assertEquals($xml, $arrayObject->toXml());
    }