/** * to update lang model for multi-language content * * @return boolean */ protected function updateLangModels() { foreach ($this->picker->getMultilangToArray() as $v) { $existed = $this->existedInLangs($v[$this->getLangIdKey()]); if (!is_null($existed)) { $existed->update($v); continue; } $this->getLangModels()->create($v); } return $this->elementsEqualsToLangModel(); }
public function testMultilangToArray() { $this->obj->import($this->rawPost); $shouldBe = [['title' => "Foo English", 'content' => "Simple example of content in English", '__lang_id__' => 1], ['title' => 'Foo Türkçe', 'content' => 'Türkçe bir içerik langur lungur bir yoğurt', '__lang_id__' => 2], ["title" => 'здравствуйте', "content" => 'Путинхороший человек. Он любит русские , я думаю, россияне любят его.', '__lang_id__' => 3]]; $this->assertEquals($shouldBe, $this->obj->getMultilangToArray()); }