Jarves\Tests\Configuration\BundleConfigTest::testObjectFromArray PHP Method

testObjectFromArray() public method

public testObjectFromArray ( )
    public function testObjectFromArray()
    {
        $entryPointsArray = array(0 => array('path' => 'backend', 'label' => 'Backend access', 'children' => array(0 => array('path' => 'chooser', 'type' => 'custom', 'label' => 'Chooser', 'fullPath' => 'backend/chooser', 'title' => 'Chooser', 'id' => 'chooser'), 1 => array('path' => 'stores', 'label' => 'Stores', 'children' => array(0 => array('path' => 'languages', 'type' => 'store', 'label' => 'Language', 'fullPath' => 'backend/stores/languages', 'title' => 'Language', 'id' => 'languages'), 1 => array('path' => 'extensions', 'type' => 'store', 'class' => 'adminStoreExtensions', 'label' => 'Extensions', 'fullPath' => 'backend/stores/extensions', 'title' => 'Extensions', 'id' => 'extensions')), 'fullPath' => 'backend/stores', 'type' => 'acl', 'title' => 'Stores', 'id' => 'stores')), 'fullPath' => 'backend', 'type' => 'acl', 'title' => 'Backend access', 'id' => 'backend'), 1 => array('path' => 'dashboard', 'type' => 'custom', 'icon' => '#icon-chart-5', 'link' => 'true', 'label' => 'Dashboard', 'fullPath' => 'dashboard', 'title' => 'Dashboard', 'id' => 'dashboard'), 2 => array('path' => 'nodes', 'type' => 'combine', 'class' => 'Admin\\Controller\\Windows\\NodeCrud', 'icon' => '#icon-screen-2', 'link' => 'true', 'label' => 'Pages', 'multi' => 'true', 'children' => array(0 => array('path' => 'add', 'type' => 'custom', 'label' => 'Add pages', 'multi' => 'true', 'fullPath' => 'nodes/add', 'title' => 'Add pages', 'id' => 'add'), 1 => array('path' => 'addDomains', 'type' => 'custom', 'label' => 'Add domains', 'multi' => 'true', 'fullPath' => 'nodes/addDomains', 'title' => 'Add domains', 'id' => 'addDomains'), 2 => array('path' => 'root', 'type' => 'combine', 'class' => '\\Admin\\Controller\\Windows\\DomainCrud', 'label' => 'Domain', 'fullPath' => 'nodes/root', 'title' => 'Domain', 'id' => 'root'), 3 => array('path' => 'frontend', 'type' => 'custom', 'label' => 'Frontend', 'fullPath' => 'nodes/frontend', 'title' => 'Frontend', 'id' => 'frontend')), 'fullPath' => 'nodes', 'title' => 'Pages', 'id' => 'nodes'));
        $entryPoints = [];
        foreach ($entryPointsArray as $entryPointArray) {
            $entryPoint = new EntryPoint(null, $this->getJarves());
            $entryPoint->fromArray($entryPointArray);
            $entryPoints[] = $entryPoint;
        }
        $xmlBackend = '<entryPoint path="backend">
  <label>Backend access</label>
  <children>
    <entryPoint path="chooser" type="custom">
      <label>Chooser</label>
    </entryPoint>
    <entryPoint path="stores">
      <label>Stores</label>
      <children>
        <entryPoint path="languages" type="store">
          <label>Language</label>
        </entryPoint>
        <entryPoint path="extensions" type="store">
          <class>adminStoreExtensions</class>
          <label>Extensions</label>
        </entryPoint>
      </children>
    </entryPoint>
  </children>
</entryPoint>';
        $xmlDashboard = '<entryPoint path="dashboard" type="custom" icon="#icon-chart-5" link="true">
  <label>Dashboard</label>
</entryPoint>';
        $xmlNodes = '<entryPoint path="nodes" type="combine" icon="#icon-screen-2" link="true" multi="true">
  <class>Admin\\Controller\\Windows\\NodeCrud</class>
  <label>Pages</label>
  <children>
    <entryPoint path="add" type="custom" multi="true">
      <label>Add pages</label>
    </entryPoint>
    <entryPoint path="addDomains" type="custom" multi="true">
      <label>Add domains</label>
    </entryPoint>
    <entryPoint path="root" type="combine">
      <class>\\Admin\\Controller\\Windows\\DomainCrud</class>
      <label>Domain</label>
    </entryPoint>
    <entryPoint path="frontend" type="custom">
      <label>Frontend</label>
    </entryPoint>
  </children>
</entryPoint>';
        $this->assertEquals($xmlBackend, $entryPoints[0]->toXml());
        $this->assertEquals($xmlDashboard, $entryPoints[1]->toXml());
        $this->assertEquals($xmlNodes, $entryPoints[2]->toXml());
    }