public function testCreate() { $post = new Post(['title' => 'New post title', 'body' => 'New post body', 'title_en' => 'New post title en', 'body_en' => 'New post body en', 'title_ru' => 'New post title ru', 'body_ru' => 'New post body ru']); $this->assertTrue($post->save()); $dataSet = $this->getConnection()->createDataSet(['post', 'postLang']); $expectedDataSet = $this->createFlatXMLDataSet(__DIR__ . '/data/test-create-post-set-translations-dublication.xml'); $this->assertDataSetsEqual($expectedDataSet, $dataSet); $post = new Post(['title' => 'New post title', 'body' => 'New post body']); $this->assertTrue($post->save()); $post = Post::findOne($post->id); $this->assertNotNull($post->title); }
public function testLocalizedAndMultilingual() { $post = Post::find()->localized()->multilingual()->limit(1)->one(); $this->assertTrue($post->isRelationPopulated('translations')); $this->assertFalse($post->isRelationPopulated('translation')); }
/** * @inheritdoc */ public function behaviors() { $behaviors = parent::behaviors(); $behaviors['ml']['requireTranslations'] = true; return $behaviors; }
/** * @inheritdoc */ public function behaviors() { $behaviors = parent::behaviors(); $behaviors['ml']['abridge'] = false; return $behaviors; }