예제 #1
0
 function testNamespace()
 {
     $this->assertFalse(ActiveMongo::setNamespace('bad namespace'));
     $this->assertFalse(ActiveMongo::setNamespace('bad=namespace'));
     $this->assertFalse(ActiveMongo::setNamespace('bad=namespace!'));
     $this->assertTrue(ActiveMongo::setNamespace('good_namespace'));
     ActiveMongo::setNamespace('testing');
     Model2::setNamespace('foobar');
     list($m1, $m2) = array(new model1(), new model2());
     $this->assertEquals($m1->collectionName(), 'testing.model1');
     $this->assertEquals($m2->collectionName(), 'foobar.model2');
     $this->assertTrue(ActiveMongo::setNamespace(NULL));
     /* set no-namespace */
     $this->assertTrue(Model2::setNamespace(NULL));
     /* set no-namespace */
 }