public function testFindAndSave() { $post = Post::findOne(4); $this->assertNotNull($post->title); $post = Post::findOne(1); $this->assertNotNull($post->title); $post = Post::find()->multilingual()->where(['id' => 1])->one(); $this->assertNotNull($post->title); $testString = 'TestString'; $post->title = $testString; $this->assertTrue($post->save()); $post = Post::find()->localized('ru')->where(['id' => $post->id])->one(); $this->assertEquals($testString, $post->title); $dataSet = $this->getConnection()->createDataSet(['post', 'postLang']); $expectedDataSet = $this->createFlatXMLDataSet(__DIR__ . '/data/test-update-populated-post-dublication.xml'); $this->assertDataSetsEqual($expectedDataSet, $dataSet); }
public function testLocalizedAndMultilingual() { $post = Post::find()->localized()->multilingual()->limit(1)->one(); $this->assertTrue($post->isRelationPopulated('translations')); $this->assertFalse($post->isRelationPopulated('translation')); }