/** * @dataProvider readMergedEntryProvider */ public function testReadMergedEntryWithTraversables($childData, $parentData, $result) { $parentData = is_array($parentData) ? new \ArrayObject($parentData) : $parentData; $childData = is_array($childData) ? new \ArrayObject($childData) : $childData; $this->readerImpl->expects($this->at(0))->method('read')->with(self::RES_DIR, 'en_GB')->will($this->returnValue(array('Foo' => array('Bar' => $childData)))); if (null === $childData || $childData instanceof \ArrayObject) { $this->readerImpl->expects($this->at(1))->method('read')->with(self::RES_DIR, 'en')->will($this->returnValue(array('Foo' => array('Bar' => $parentData)))); } $this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'en_GB', array('Foo', 'Bar'), true)); }
/** * @dataProvider provideMergeableValues */ public function testFollowLocaleAliases($childData, $parentData, $result) { $this->reader->setLocaleAliases(array('mo' => 'ro_MD')); if (null === $childData || is_array($childData)) { $this->readerImpl->expects($this->at(0))->method('read')->with(self::RES_DIR, 'ro_MD')->will($this->returnValue(array('Foo' => array('Bar' => $childData)))); // Read fallback locale of aliased locale ("ro_MD" -> "ro") $this->readerImpl->expects($this->at(1))->method('read')->with(self::RES_DIR, 'ro')->will($this->returnValue(array('Foo' => array('Bar' => $parentData)))); } else { $this->readerImpl->expects($this->once())->method('read')->with(self::RES_DIR, 'ro_MD')->will($this->returnValue(array('Foo' => array('Bar' => $childData)))); } $this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'mo', array('Foo', 'Bar'), true)); }