Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix guest manager test, remove command output
Signed-off-by: Vincent Petry <[email protected]>
  • Loading branch information
PVince81 committed Dec 16, 2020
commit 42b50505193114cfa7c11f340dda1bb64d0d0c12
4 changes: 2 additions & 2 deletions lib/Command/AddCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@

namespace OCA\Guests\Command;

use OC\Core\Command\Base;
use OCA\Guests\GuestManager;
use OCP\IUser;
use OCP\IUserManager;
use OCP\Mail\IMailer;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\Question;

class AddCommand extends Base {
class AddCommand extends Command {
private $guestManager;
private $mailer;

Expand Down
9 changes: 7 additions & 2 deletions tests/unit/GuestManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,22 +164,27 @@ public function testCreateGuest() {
$createdByUser->method('getUID')
->willReturn('creator');

$guestUser = $this->createMock(IUser::class);

$this->userManager->expects($this->once())
->method('createUserFromBackend')
->with('[email protected]', str_repeat('4', 20), $this->userBackend);
->with('[email protected]', str_repeat('4', 20), $this->userBackend)
->willReturn($guestUser);

$this->userBackend->expects($this->once())
->method('setDisplayName')
->with('[email protected]', 'Example Guest');

$this->guestManager->createGuest(
$returnedUser = $this->guestManager->createGuest(
$createdByUser,
'[email protected]',
'[email protected]',
'Example Guest',
'test'
);

$this->assertSame($guestUser, $returnedUser);

$token = str_repeat('4', 21);
$this->assertEquals([
'settings' => ['email' => '[email protected]'],
Expand Down