Example #1
0
 public function testCollectionsUsedByPrivateFields()
 {
     $structure = new Structure();
     $structure->add($foo = new Field('foo', Mapping::TYPE_STRING, ['private' => true, 'used_by_collections' => [1, 2]]));
     $structure->add(new Field('foo', Mapping::TYPE_STRING, ['private' => true, 'used_by_collections' => [2, 3]]));
     $structure->add(new Field('bar', Mapping::TYPE_STRING, ['private' => true, 'used_by_collections' => [2, 3]]));
     $structure->add(new Field('baz', Mapping::TYPE_STRING, ['private' => false]));
     $this->assertEquals([1, 2], $foo->getDependantCollections());
     static $expected = ['foo' => [1, 2, 3], 'bar' => [2, 3]];
     $this->assertEquals($expected, $structure->getCollectionsUsedByPrivateFields());
 }