public function testI18nWithRelations2() { \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'); \ToyI18nQuery::create()->deleteAll(); $count = \ToyI18nQuery::create()->count(); $this->assertEquals(0, $count, 'No i18n toys before the test'); \MovieI18nQuery::create()->deleteAll(); $count = \MovieI18nQuery::create()->count(); $this->assertEquals(0, $count, 'No i18n movies before the test'); $t = new \Toy(); $t->setLocale('en'); $t->setName('My Name'); $t->setLocale('fr'); $t->setName('Mon Nom'); $t->setLocale('en'); $this->assertEquals('My Name', $t->getName()); $t->setLocale('fr'); $this->assertEquals('Mon Nom', $t->getName()); $m = new \Movie(); $m->addToy($t); $m->save(); $count = \MovieQuery::create()->count(); $this->assertEquals(1, $count, '1 movie'); $count = \ToyQuery::create()->count(); $this->assertEquals(1, $count, '1 toy'); $count = \ToyI18nQuery::create()->count(); $this->assertEquals(2, $count, '2 i18n toys'); $count = \MovieI18nQuery::create()->count(); $this->assertEquals(0, $count, '0 i18n movies'); }