public function testToArray() { $expected = ['name' => 'foo', 'key' => 'bar', 'resourceLocator' => ['strategy' => 'hello'], 'localizations' => [['foo']], 'environments' => [['type' => 'd']]]; $this->environment->toArray()->willReturn($expected['environments'][0]); $this->environment->getType()->willReturn('d'); $this->localization->toArray()->willReturn($expected['localizations'][0]); $this->localization->isDefault()->willReturn(true); $this->environment->getUrls()->willReturn([]); $this->portal->addEnvironment($this->environment->reveal()); $this->portal->addLocalization($this->localization->reveal()); $this->portal->setResourceLocatorStrategy($expected['resourceLocator']['strategy']); $this->portal->setName($expected['name']); $this->portal->setKey($expected['key']); $this->assertEquals($expected, $this->portal->toArray()); }