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 canReturnSkillVerificationLinkForEducationalWithCampaign() { $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/678', $subject->getVerificationLink('education', null, Link::SKILL, 678) ); } /** * @test */ public function canReturnSkillVerificationLinkForBusiness() { $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 canReturnSkillVerificationLinkForCertification() { $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 canReturnSkillVerificationLinkForSelf() { $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 canReturnSkillVerificationButtonForEducational() { $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 canReturnSkillVerificationButtonForBusiness() { $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 canReturnSkillVerificationButtonForCertification() { $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 canReturnSkillVerificationButtonForSelf() { $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 canReturnSkillSetVerificationLinkForEducational() { $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/skillset/10/0/2', $subject->getVerificationLink('education', null, Link::SKILL_SET) ); } /** * @test */ public function canReturnSkillSetVerificationLinkForBusiness() { $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/skillset/10/0/4', $subject->getVerificationLink('business', null, Link::SKILL_SET) ); } /** * @test */ public function canReturnSkillSetVerificationLinkForCertification() { $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/skillset/10/0/1', $subject->getVerificationLink('certification', null, Link::SKILL_SET) ); } /** * @test */ public function canReturnSkillSetVerificationLinkForSelf() { $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/skillset/10/0/3', $subject->getVerificationLink('self', null, Link::SKILL_SET) ); } /** * @test */ public function canReturnSkillSetVerificationButtonForEducational() { $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', null, Link::SKILL_SET) ); } /** * @test */ public function canReturnSkillSetVerificationButtonForBusiness() { $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', null, Link::SKILL_SET) ); } /** * @test */ public function canReturnSkillSetVerificationButtonForCertification() { $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', null, Link::SKILL_SET) ); } /** * @test */ public function canReturnSkillSetVerificationButtonForSelf() { $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', null, Link::SKILL_SET) ); } /** * @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 ID provided.'); $this->expectExceptionCode(1599723825); $subject->getVerificationLink('education'); } /** * @test */ public function throwsExceptionIfInvalidTypeIsProvided() { $settings = $this->prophesize(Settings::class); $settings->getMySkillDisplayUrl()->willReturn('https://my.example.com/verify'); $subject = new Link($settings->reveal()); $this->expectExceptionMessage('$type has to be "skill" or "skillset" but "invalid" given.'); $this->expectExceptionCode(1600774955); $subject->getVerificationLink('education', null, 'invalid'); } }