'value' ]; private const ROLES = [ 'Learner' ]; /** @var Lti1p3LaunchRequestFactory|MockObject */ private $launchRequestFactory; /** @var Lti1p1Launcher */ private $subject; public function setUp(): void { $this->launchRequestFactory = $this->createMock(Lti1p3LaunchRequestFactory::class); $this->subject = new Lti1p1Launcher(); } public function testLaunch(): void { $ltiProvider = $this->createMock(LtiProvider::class); $ltiProvider->method('getKey') ->willReturn('key'); $ltiProvider->method('getSecret') ->willReturn('secret'); $user = $this->createMock(User::class); $command = new LtiLaunchCommand( $ltiProvider, self::ROLES, self::CLAIMS, self::RESOURCE_IDENTIFIER, $user, self::LOGIN_HINT, self::LAUNCH_URL ); $launch = $this->subject->launch($command); $launchParams = $launch->getToolLaunchParams(); $this->assertSame(self::LAUNCH_URL, $launch->getToolLaunchUrl()); $this->assertSame('1.0', $launchParams['oauth_version']); $this->assertSame('HMAC-SHA1', $launchParams['oauth_signature_method']); $this->assertSame('key', $launchParams['oauth_consumer_key']); $this->assertSame('LTI-1p0', $launchParams['lti_version']); $this->assertSame(null, $launchParams['user_id']); $this->assertSame('value', $launchParams['claim']); $this->assertSame('Learner', $launchParams['roles']); } }