public function testToArray() { $books_by_lee = ['To Kill a Mockingbird', 'Go Set a Watchman']; $books_by_wilder = ['Little House in the Big Woods', 'Little House on the Prairie']; $books = new Dictionary(['Harper Lee' => new OrderedList($books_by_lee), 'Laura Ingles Wilder' => new OrderedList($books_by_wilder)]); $expect = ['Harper Lee' => $books_by_lee, 'Laura Ingles Wilder' => $books_by_wilder]; $this->assertSame($expect, $books->toArray()); }
public function testWithoutValue() { $this->assertArrayHasKey('one', $this->struct); $copy = $this->struct->withoutValue('one'); $this->assertNotSame($this->struct, $copy); $this->assertArrayNotHasKey('one', $copy); // Removing the a non-exisistant value should not copy $another = $copy->withoutValue('one'); $this->assertSame($copy, $another); }
/** * @inheritDoc */ public function __construct(array $data = []) { $data += ['text/html' => PrettyPageHandler::class, 'application/javascript' => JsonResponseHandler::class, 'application/json' => JsonResponseHandler::class, 'application/ld+json' => JsonResponseHandler::class, 'application/vnd.api+json' => JsonResponseHandler::class, 'application/vnd.geo+json' => JsonResponseHandler::class, 'application/xml' => XmlResponseHandler::class, 'application/atom+xml' => XmlResponseHandler::class, 'application/rss+xml' => XmlResponseHandler::class, 'text/plain' => PlainTextHandler::class]; // @codeCoverageIgnore parent::__construct($data); }
/** * @inheritDoc * * @throws DirectoryException If a value is not an Action instance */ protected function assertValid(array $data) { parent::assertValid($data); foreach ($data as $value) { if (!is_object($value) || !$value instanceof Action) { throw DirectoryException::invalidEntry($value); } } }