Пример #1
0
 protected function getComposite()
 {
     $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);
     $fkc1->setOption('foreignTable', $tableA->getId());
     $fkc1->setOption('foreignColumn', $columnA1->getId());
     $columnC2->addChild($fkc1);
     $tableC->addChild($columnC1);
     $tableC->addChild($columnC2);
     $tableB->addChild($columnB1);
     $tableB->addChild($columnB2);
     $tableA->addChild($columnA1);
     $tableA->addChild($columnA2);
     $schema->addChild($tableC);
     $schema->addChild($tableB);
     $schema->addChild($tableA);
     return $schema;
 }
 protected function getComposite()
 {
     $event = $this->getMockBuilder('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface')->getMock();
     $schema = new SchemaNode('schema', $event);
     $formatter = $this->getMockBuilder('Faker\\Tests\\Engine\\Common\\Formatter\\Mock\\MockFormatter')->disableOriginalConstructor()->getMock();
     $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);
     $fmNode = new FormatterNode('fmnode', $event, $formatter);
     $fkc1->setOption('foreignTable', $tableA->getId());
     $fkc1->setOption('foreignColumn', $columnA1->getId());
     $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);
     $schema->addChild($fmNode);
     return $schema;
 }
Пример #3
0
 public function getNode()
 {
     $name = $this->name;
     $event = $this->eventDispatcher;
     $node = new ColumnNode($name, $event);
     # bind properties
     $node->setDBALType($this->dbalType);
     return $node;
 }
Пример #4
0
 public function testVisititorVisitsChildren()
 {
     $id = 'schema_1';
     $event = $this->getMockBuilder('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface')->getMock();
     $columnNode = new ColumnNode($id, $event);
     $child_a = $this->getMockBuilder('Faker\\Tests\\Engine\\DB\\Mock\\MockNode')->disableOriginalConstructor()->getMock();
     $child_a->expects($this->once())->method('acceptVisitor')->with($this->isInstanceOf('Faker\\Components\\Engine\\Common\\Visitor\\BasicVisitor'));
     $child_b = $this->getMockBuilder('Faker\\Tests\\Engine\\DB\\Mock\\MockNode')->disableOriginalConstructor()->getMock();
     $child_b->expects($this->once())->method('acceptVisitor')->with($this->isInstanceOf('Faker\\Components\\Engine\\Common\\Visitor\\BasicVisitor'));
     $visitor = $this->getMockBuilder('Faker\\Components\\Engine\\Common\\Visitor\\BasicVisitor')->disableOriginalConstructor()->getMock();
     $columnNode->addChild($child_a);
     $columnNode->addChild($child_b);
     $columnNode->acceptVisitor($visitor);
 }