OrderedHashMap example

use PHPUnit\Framework\TestCase;
use Symfony\Component\Form\Util\OrderedHashMap;

/** * @author Bernhard Schussek <bschussek@gmail.com> */
class OrderedHashMapTest extends TestCase
{
    public function testGet()
    {
        $map = new OrderedHashMap();
        $map['first'] = 1;

        $this->assertSame(1, $map['first']);
    }

    public function testGetNonExistingFails()
    {
        $this->expectException(\OutOfBoundsException::class);
        $map = new OrderedHashMap();

        $map['first'];
    }
        if ($config->getCompound() && !$config->getDataMapper()) {
            throw new LogicException('Compound forms need a data mapper.');
        }

        // If the form inherits the data from its parent, it is not necessary         // to call setData() with the default data.         if ($this->inheritData = $config->getInheritData()) {
            $this->defaultDataSet = true;
        }

        $this->config = $config;
        $this->children = new OrderedHashMap();
        $this->name = $config->getName();
    }

    public function __clone()
    {
        $this->children = clone $this->children;

        foreach ($this->children as $key => $child) {
            $this->children[$key] = clone $child;
        }
    }

    
Home | Imprint | This part of the site doesn't use cookies.