public function testRemoveClassmates()
 {
     $john = new DBStudent();
     $john->setName('john');
     $jean = new DBStudent();
     $jean->setName('jean');
     $phil = new DBStudent();
     $phil->setName('phil');
     $john->setClassmates(array($jean, $phil));
     $john->save();
     $this->assertEquals(3, DBStudentQuery::create()->count());
     $this->assertTrue($john->hasClassmate($jean));
     $this->assertTrue($john->hasClassmate($phil));
     $this->assertTrue($phil->hasClassmate($john));
     $this->assertTrue($jean->hasClassmate($john));
     $john->removeClassmates();
     $this->assertEquals(0, count($john->getClassmates()));
     $this->assertEquals(3, DBStudentQuery::create()->count());
     $this->assertFalse($john->hasClassmate($phil));
     $this->assertFalse($john->hasClassmate($jean));
     $this->assertFalse($phil->hasClassmate($john));
     $this->assertFalse($jean->hasClassmate($john));
     $john->save();
     $this->assertEquals(3, DBStudentQuery::create()->count());
     $this->assertEquals(0, DBClassmateQuery::create()->count());
     $this->assertEquals(0, count($john->getClassmates()));
     $this->assertFalse($john->hasClassmate($phil));
     $this->assertFalse($john->hasClassmate($jean));
     $this->assertFalse($phil->hasClassmate($john));
     $this->assertFalse($jean->hasClassmate($john));
 }