public function testAllowsSettingSearchParamsAsJson() { $arrayValue = ['test' => 'works']; $arrayExpect = \Zend\Json\Json::encode($arrayValue); $traversableValue = new \ArrayIterator($arrayValue); $traversableExpect = \Zend\Json\Json::encode($arrayValue); $this->assertSame($this->target, $this->target->setSearchParams($arrayValue), 'breaks fluent interface.'); $this->assertEquals($arrayExpect, $this->target->getAttribute('data-search-params'), 'Setting array failed.'); $this->target->setSearchParams($traversableValue); $this->assertEquals($traversableExpect, $this->target->getAttribute('data-search-params'), 'Setting \\Traversable failed.'); }