コード例 #1
0
 protected function getMockComposite()
 {
     $event = $this->getMockBuilder('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface')->getMock();
     $schema = new SchemaNode('schema', $event);
     $tableA = new TableNode('tableA', $event);
     $columnA1 = new ColumnNode('columnA1', $event);
     $columnA2 = new ColumnNode('columnA2', $event);
     $tableB = new TableNode('tableB', $event);
     $columnB1 = new ColumnNode('columnB1', $event);
     $columnB2 = new ColumnNode('columnB2', $event);
     $tableC = new TableNode('tableC', $event);
     $columnC1 = new ColumnNode('columnC1', $event);
     $columnC2 = new ColumnNode('columnC2', $event);
     $fkc1 = new ForeignKeyNode('fkc1', $event);
     $columnC2->addChild($fkc1);
     $tableC->addChild($columnC1);
     $tableC->addChild($columnC2);
     $tableB->addChild($columnB1);
     $tableB->addChild($columnB2);
     $tableA->addChild($columnA1);
     $tableA->addChild($columnA2);
     $schema->addChild($tableA);
     $schema->addChild($tableB);
     $schema->addChild($tableC);
     return $schema;
 }
コード例 #2
0
 /**
  *  @expectedException Faker\Components\Engine\Common\Composite\CompositeException
  *  @expectedExceptionMessage Schema must have a name
  */
 public function testValidateFailsWithEmptyId()
 {
     $utilities = $this->getMockBuilder('Faker\\Components\\Engine\\Common\\Utilities')->getMock();
     $generator = $this->getMock('\\PHPStats\\Generator\\GeneratorInterface');
     $locale = $this->getMock('\\Faker\\Locale\\LocaleInterface');
     $event = $this->getMockBuilder('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface')->getMock();
     $id = null;
     $type = new SchemaNode($id, $event);
     $type->validate();
 }