From ac31dd09d08d70a10b9138968ed20f91e2cf13b7 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 19 Oct 2020 11:48:02 +0200 Subject: [PATCH] Fix wrong verification link for skillsets For whatever reason, URL structure is different for skillsets compared to skills. --- src/Verification/Link.php | 9 ++++++++- tests/Unit/Verification/LinkTest.php | 16 ++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/Verification/Link.php b/src/Verification/Link.php index a73a9d8..bc13f43 100644 --- a/src/Verification/Link.php +++ b/src/Verification/Link.php @@ -99,7 +99,14 @@ class Link throw new \InvalidArgumentException('No ID provided.', 1599723825); } - $link = $this->settings->getMySkillDisplayUrl() . '/skillup/' . $type . '/' . $id . '/0/'; + $link = $this->settings->getMySkillDisplayUrl() . '/skillup/' . $type . '/'; + + if ($type === self::SKILL_SET) { + $link .= '0/' . $id . '/'; + } else { + $link .= $id . '/0/'; + } + switch ($vtype) { case VERIFICATION_EDUCATIONAL: $link .= '2'; diff --git a/tests/Unit/Verification/LinkTest.php b/tests/Unit/Verification/LinkTest.php index 5c582c4..1b3afee 100644 --- a/tests/Unit/Verification/LinkTest.php +++ b/tests/Unit/Verification/LinkTest.php @@ -210,7 +210,7 @@ class LinkTest extends TestCase $subject = new Link($settings->reveal(), 10); static::assertSame( - 'https://my.example.com/verify/skillup/skillset/10/0/2', + 'https://my.example.com/verify/skillup/skillset/0/10/2', $subject->getVerificationLink('education', null, Link::SKILL_SET) ); } @@ -226,7 +226,7 @@ class LinkTest extends TestCase $subject = new Link($settings->reveal(), 10); static::assertSame( - 'https://my.example.com/verify/skillup/skillset/10/0/4', + 'https://my.example.com/verify/skillup/skillset/0/10/4', $subject->getVerificationLink('business', null, Link::SKILL_SET) ); } @@ -242,7 +242,7 @@ class LinkTest extends TestCase $subject = new Link($settings->reveal(), 10); static::assertSame( - 'https://my.example.com/verify/skillup/skillset/10/0/1', + 'https://my.example.com/verify/skillup/skillset/0/10/1', $subject->getVerificationLink('certification', null, Link::SKILL_SET) ); } @@ -258,7 +258,7 @@ class LinkTest extends TestCase $subject = new Link($settings->reveal(), 10); static::assertSame( - 'https://my.example.com/verify/skillup/skillset/10/0/3', + 'https://my.example.com/verify/skillup/skillset/0/10/3', $subject->getVerificationLink('self', null, Link::SKILL_SET) ); } @@ -275,7 +275,7 @@ class LinkTest extends TestCase static::assertSame( implode(PHP_EOL, [ - ' ', + ' ', ' ', ' ', ' ', @@ -299,7 +299,7 @@ class LinkTest extends TestCase static::assertSame( implode(PHP_EOL, [ - ' ', + ' ', ' ', ' ', ' ', @@ -323,7 +323,7 @@ class LinkTest extends TestCase static::assertSame( implode(PHP_EOL, [ - ' ', + ' ', ' ', ' ', ' ', @@ -347,7 +347,7 @@ class LinkTest extends TestCase static::assertSame( implode(PHP_EOL, [ - ' ', + ' ', ' ', ' ', ' ',