public function testI18nWithRelations() { \MovieQuery::create()->deleteAll(); $count = \MovieQuery::create()->count(); $this->assertEquals(0, $count, 'No movie before the test'); \ToyQuery::create()->deleteAll(); $count = \ToyQuery::create()->count(); $this->assertEquals(0, $count, 'No toy before the test'); \MovieI18nQuery::create()->deleteAll(); $count = \MovieI18nQuery::create()->count(); $this->assertEquals(0, $count, 'No i18n movies before the test'); $m = new \Movie(); $m->setLocale('en'); $m->setTitle('V For Vendetta'); $m->setLocale('fr'); $m->setTitle('V Pour Vendetta'); $m->setLocale('en'); $this->assertEquals('V For Vendetta', $m->getTitle()); $m->setLocale('fr'); $this->assertEquals('V Pour Vendetta', $m->getTitle()); $t = new \Toy(); $t->setMovie($m); $t->save(); $count = \MovieQuery::create()->count(); $this->assertEquals(1, $count, '1 movie'); $count = \ToyQuery::create()->count(); $this->assertEquals(1, $count, '1 toy'); $count = \MovieI18nQuery::create()->count(); $this->assertEquals(2, $count, '2 i18n movies'); $count = \ToyI18nQuery::create()->count(); $this->assertEquals(0, $count, '0 i18n toys'); }