public function testForecastOfOpportunitiesValuesWithBusinessUnits()
 {
     $user = new User();
     $user->setId(1);
     $businessUnit = new BusinessUnit();
     $businessUnit->addUser($user);
     $options = ['owners' => [], 'businessUnits' => [$businessUnit]];
     $widgetOptions = new WidgetOptionBag($options);
     $this->opportunityRepository->expects($this->any())->method('getForecastOfOpporunitiesData')->with([$user->getId()], null, $this->aclHelper)->will($this->returnValue(['inProgressCount' => 5, 'budgetAmount' => 1000, 'weightedForecast' => 500]));
     $this->businessUnitRepository->expects($this->any())->method('findById')->will($this->returnValue([$businessUnit]));
     $result = $this->provider->getForecastOfOpportunitiesValues($widgetOptions, 'getInProgressValues', 'integer', false);
     $this->assertEquals(['value' => 5], $result);
     $result = $this->provider->getForecastOfOpportunitiesValues($widgetOptions, 'getTotalForecastValues', 'currency', false);
     $this->assertEquals(['value' => 1000], $result);
     $result = $this->provider->getForecastOfOpportunitiesValues($widgetOptions, 'getWeightedForecastValues', 'currency', false);
     $this->assertEquals(['value' => 500], $result);
 }
 public function testUser()
 {
     $businessUnit = new BusinessUnit();
     $user = new User();
     $businessUnit->setUsers(new ArrayCollection(array($user)));
     $this->assertContains($user, $businessUnit->getUsers());
     $businessUnit->removeUser($user);
     $this->assertNotContains($user, $businessUnit->getUsers());
     $businessUnit->addUser($user);
     $this->assertContains($user, $businessUnit->getUsers());
 }