public function preSetData()
 {
     $entityConfigId = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\Id\\EntityConfigId')->disableOriginalConstructor()->getMock();
     $user = new User();
     $user->setId(1);
     $organization = new Organization();
     $organization->setId(3);
     $userConfig = new Config($entityConfigId);
     $userConfig->setValues(["owner_type" => "USER", "owner_field_name" => "owner", "owner_column_name" => "owner_id", "organization_field_name" => "organization", "organization_column_name" => "organization_id"]);
     $buConfig = new Config($entityConfigId);
     $buConfig->setValues(["owner_type" => "BUSINESS_UNIT", "owner_field_name" => "owner", "owner_column_name" => "owner_id", "organization_field_name" => "organization", "organization_column_name" => "organization_id"]);
     $organizationConfig = new Config($entityConfigId);
     $organizationConfig->setValues(["owner_type" => "ORGANIZATION", "owner_field_name" => "owner", "owner_column_name" => "owner_id"]);
     return ['OwnershipType User with UsernamePasswordOrganizationToken' => [new UsernamePasswordOrganizationToken($user, 'admin', 'key', $organization), $userConfig, ['owner' => $user, 'organization' => $organization]], 'OwnershipType BusinessUnit with UsernamePasswordOrganizationToken' => [new UsernamePasswordOrganizationToken($user, 'admin', 'key', $organization), $buConfig, ['organization' => $organization]], 'OwnershipType Organization with UsernamePasswordOrganizationToken' => [new UsernamePasswordOrganizationToken($user, 'admin', 'key', $organization), $organizationConfig, ['owner' => $organization]], 'OwnershipType User with UsernamePasswordToken' => [new UsernamePasswordToken($user, 'admin', 'key'), $userConfig, ['owner' => $user]], 'OwnershipType BusinessUnit with UsernamePasswordToken' => [new UsernamePasswordToken($user, 'admin', 'key'), $buConfig, []], 'OwnershipType Organization with UsernamePasswordToken' => [new UsernamePasswordToken($user, 'admin', 'key'), $organizationConfig, []]];
 }
 protected function addUserInfoToTree(OwnerTree $tree, User $user)
 {
     $owner = $user->getOwner();
     $tree->addUser($user->getId(), $owner ? $owner->getId() : null);
     foreach ($user->getOrganizations() as $organization) {
         $tree->addUserOrganization($user->getId(), $organization->getId());
         foreach ($user->getBusinessUnits() as $businessUnit) {
             $organizationId = $organization->getId();
             $buOrganizationId = $businessUnit->getOrganization()->getId();
             if ($organizationId == $buOrganizationId) {
                 $tree->addUserBusinessUnit($user->getId(), $organizationId, $businessUnit->getId());
             }
         }
     }
 }