示例#1
0
 public function testConfigClasses()
 {
     $mondator = new Mondator();
     $mondator->setConfigClass('Article', $article = array('title' => 'string', 'content' => 'string'));
     $mondator->setConfigClass('Comment', $comment = array('name' => 'string', 'text' => 'string'));
     $this->assertTrue($mondator->hasConfigClass('Article'));
     $this->assertFalse($mondator->hasConfigClass('Category'));
     $this->assertSame($article, $mondator->getConfigClass('Article'));
     $this->assertSame($comment, $mondator->getConfigClass('Comment'));
     $this->assertSame(array('Article' => $article, 'Comment' => $comment), $mondator->getConfigClasses());
     $mondator->setConfigClasses($classes = array('Category' => array('name' => 'string'), 'Post' => array('message' => 'string')));
     $this->assertSame($classes, $mondator->getConfigClasses());
 }