prophesize(Settings::class); $subject = new Link( $settings->reveal(), 10 ); static::assertInstanceOf(Link::class, $subject); } /** * @test */ public function instanceCanBeCreatedWithoutSkillId() { $settings = $this->prophesize(Settings::class); $subject = new Link($settings->reveal()); static::assertInstanceOf(Link::class, $subject); } /** * @test */ public function canReturnVerificationLinkForEducational() { $settings = $this->prophesize(Settings::class); $settings->getMySkillDisplayUrl()->willReturn('https://my.example.com/verify'); $subject = new Link($settings->reveal(), 10); static::assertSame( 'https://my.example.com/verify/skillup/skill/10/0/2', $subject->getVerificationLink('education') ); } /** * @test */ public function canReturnVerificationLinkForBusiness() { $settings = $this->prophesize(Settings::class); $settings->getMySkillDisplayUrl()->willReturn('https://my.example.com/verify'); $subject = new Link($settings->reveal(), 10); static::assertSame( 'https://my.example.com/verify/skillup/skill/10/0/4', $subject->getVerificationLink('business') ); } /** * @test */ public function canReturnVerificationLinkForCertification() { $settings = $this->prophesize(Settings::class); $settings->getMySkillDisplayUrl()->willReturn('https://my.example.com/verify'); $subject = new Link($settings->reveal(), 10); static::assertSame( 'https://my.example.com/verify/skillup/skill/10/0/1', $subject->getVerificationLink('certification') ); } /** * @test */ public function canReturnVerificationLinkForSelf() { $settings = $this->prophesize(Settings::class); $settings->getMySkillDisplayUrl()->willReturn('https://my.example.com/verify'); $subject = new Link($settings->reveal(), 10); static::assertSame( 'https://my.example.com/verify/skillup/skill/10/0/3', $subject->getVerificationLink('self') ); } /** * @test */ public function canReturnVerificationButtonForEducational() { $settings = $this->prophesize(Settings::class); $settings->getMySkillDisplayUrl()->willReturn('https://my.example.com/verify'); $subject = new Link($settings->reveal(), 10); static::assertSame( implode(PHP_EOL, [ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ]), $subject->getVerificationButton('education') ); } /** * @test */ public function canReturnVerificationButtonForBusiness() { $settings = $this->prophesize(Settings::class); $settings->getMySkillDisplayUrl()->willReturn('https://my.example.com/verify'); $subject = new Link($settings->reveal(), 10); static::assertSame( implode(PHP_EOL, [ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ]), $subject->getVerificationButton('business') ); } /** * @test */ public function canReturnVerificationButtonForCertification() { $settings = $this->prophesize(Settings::class); $settings->getMySkillDisplayUrl()->willReturn('https://my.example.com/verify'); $subject = new Link($settings->reveal(), 10); static::assertSame( implode(PHP_EOL, [ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ]), $subject->getVerificationButton('certification') ); } /** * @test */ public function canReturnVerificationButtonForSelf() { $settings = $this->prophesize(Settings::class); $settings->getMySkillDisplayUrl()->willReturn('https://my.example.com/verify'); $subject = new Link($settings->reveal(), 10); static::assertSame( implode(PHP_EOL, [ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ]), $subject->getVerificationButton('self') ); } /** * @test */ public function throwsExceptionIfNoSkillIdIsProvided() { $settings = $this->prophesize(Settings::class); $settings->getMySkillDisplayUrl()->willReturn('https://my.example.com/verify'); $subject = new Link($settings->reveal()); $this->expectExceptionMessage('No skill ID provided.'); $this->expectExceptionCode(1599723825); $subject->getVerificationLink('education'); } }