コード例 #1
0
 /**
  * @inheritdoc
  */
 public function run(IOutput $output)
 {
     $output->startProgress();
     $this->userManager->callForAllUsers(function ($user) use($output) {
         /** @var IUser $user */
         $output->advance(1, $user->getDisplayName());
         $this->birthdayService->syncUser($user->getUID());
     });
     $output->finishProgress();
 }
コード例 #2
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $user = $input->getArgument('user');
     if (!is_null($user)) {
         if (!$this->userManager->userExists($user)) {
             throw new \InvalidArgumentException("User <{$user}> in unknown.");
         }
         $output->writeln("Start birthday calendar sync for {$user}");
         $this->birthdayService->syncUser($user);
         return;
     }
     $output->writeln("Start birthday calendar sync for all users ...");
     $p = new ProgressBar($output);
     $p->start();
     $this->userManager->callForAllUsers(function ($user) use($p) {
         $p->advance();
         /** @var IUser $user */
         $this->birthdayService->syncUser($user->getUID());
     });
     $p->finish();
     $output->writeln('');
 }
コード例 #3
0
 /**
  * @dataProvider providesBirthday
  * @param $expected
  * @param $old
  * @param $new
  */
 public function testBirthdayEvenChanged($expected, $old, $new)
 {
     $new = Reader::read($new);
     $this->assertEquals($expected, $this->service->birthdayEvenChanged($old, $new));
 }