Skip to content

Commit 9e7c83b

Browse files
committed
SDK-848: Annotate unit tests
1 parent fc646f4 commit 9e7c83b

18 files changed

+397
-30
lines changed

tests/ActivityDetailsTest.php

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
use Yoti\Entity\Image;
1010
use Yoti\Entity\ApplicationProfile;
1111

12+
/**
13+
* @coversDefaultClass \Yoti\ActivityDetails
14+
*/
1215
class ActivityDetailsTest extends TestCase
1316
{
1417
/**
@@ -26,6 +29,9 @@ class ActivityDetailsTest extends TestCase
2629
*/
2730
public $applicationProfile;
2831

32+
/**
33+
* @var string Remember Me ID
34+
*/
2935
public $rememberMeId = 'Hig2yAT79cWvseSuXcIuCLa5lNkAPy70rxetUaeHlTJGmiwc/g1MWdYWYrexWvPU';
3036

3137
public function setUp()
@@ -40,34 +46,40 @@ public function setUp()
4046
}
4147

4248
/**
43-
* Test getting ActivityDetails Instance
49+
* Test getting ActivityDetails Instance.
4450
*/
4551
public function testActivityDetailsInstance()
4652
{
4753
$this->assertInstanceOf(ActivityDetails::class, $this->activityDetails);
4854
}
4955

5056
/**
51-
* Test getting RememberMeId
57+
* @covers ::getRememberMeId
5258
*/
5359
public function testGetRememberMeId()
5460
{
5561
$this->assertEquals($this->rememberMeId, $this->activityDetails->getRememberMeId());
5662
}
5763

64+
/**
65+
* @covers ::getParentRememberMeId
66+
*/
5867
public function testGetParentRememberMeIdExists()
5968
{
6069
$this->assertTrue(method_exists($this->activityDetails, 'getParentRememberMeId'));
6170
}
6271

6372
/**
64-
* Test getting Given Names
73+
* @covers ::getProfile
6574
*/
6675
public function testGetProfile()
6776
{
6877
$this->assertInstanceOf(Profile::class, $this->activityDetails->getProfile());
6978
}
7079

80+
/**
81+
* @covers ::getApplicationProfile
82+
*/
7183
public function testGetApplicationProfile()
7284
{
7385
$this->assertInstanceOf(
@@ -77,60 +89,68 @@ public function testGetApplicationProfile()
7789
}
7890

7991
/**
80-
* Test getting Family Name
92+
* @covers \Yoti\Entity\Profile::getFamilyName
8193
*/
8294
public function testGetFamilyName()
8395
{
8496
$this->assertNull($this->profile->getFamilyName());
8597
}
8698

8799
/**
88-
* Test getting Full Name
100+
* @covers \Yoti\Entity\Profile::getFullName
89101
*/
90102
public function testGetFullName()
91103
{
92104
$this->assertNull($this->profile->getFullName());
93105
}
94106

95107
/**
96-
* Test getting Date Of Birth
108+
* @covers \Yoti\Entity\Profile::getDateOfBirth
97109
*/
98110
public function testGetDateOfBirth()
99111
{
100112
$this->assertNull($this->profile->getDateOfBirth());
101113
}
102114

103115
/**
104-
* Test getting Phone Number
116+
* @covers \Yoti\Entity\Profile::getPhoneNumber
117+
* @covers \Yoti\Entity\Attribute::getValue
105118
*/
106119
public function testGetPhoneNumber()
107120
{
108121
$this->assertEquals('+447474747474', $this->profile->getPhoneNumber()->getValue());
109122
}
110123

111124
/**
112-
* Test getting Email Address
125+
* @covers \Yoti\Entity\Profile::getEmailAddress
113126
*/
114127
public function testGetEmailAddress()
115128
{
116129
$this->assertNull($this->profile->getEmailAddress());
117130
}
118131

119132
/**
120-
* Test getting Selfie
133+
* @covers \Yoti\Entity\Profile::getSelfie
134+
* @covers \Yoti\Entity\Attribute::getValue
121135
*/
122136
public function testGetSelfie()
123137
{
124138
$this->assertInstanceOf(Attribute::class, $this->profile->getSelfie());
125139
$this->assertInstanceOf(Image::class, $this->profile->getSelfie()->getValue());
126140
}
127141

142+
/**
143+
* ::getTimestamp
144+
*/
128145
public function testGetTimestamp()
129146
{
130147
$timestamp = $this->activityDetails->getTimestamp();
131148
$this->assertEquals('19-07-2016 08:55:38', $timestamp->format('d-m-Y H:i:s'));
132149
}
133150

151+
/**
152+
* ::getReceiptId
153+
*/
134154
public function testGetReceipt()
135155
{
136156
$receiptId = '9HNJDX5bEIN5TqBm0OGzVIc1LaAmbzfx6eIrwNdwpHvKeQmgPujyogC+r7hJCVPl';

tests/Entity/AnchorTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,25 @@
88
use YotiTest\Util\Profile\TestAnchors;
99
use Yoti\Util\Profile\AnchorListConverter;
1010

11+
/**
12+
* @coversDefaultClass \Yoti\Entity\Anchor
13+
*/
1114
class AnchorTest extends TestCase
1215
{
16+
/**
17+
* Check Anchor class exists.
18+
*/
1319
public function testAnchorClassExists()
1420
{
1521
$this->assertTrue(class_exists(Anchor::class));
1622
}
1723

24+
/**
25+
* @covers ::getType
26+
* @covers ::getValue
27+
* @covers ::getSignedTimeStamp
28+
* @covers ::getOriginServerCerts
29+
*/
1830
public function testYotiAnchorEndpoints()
1931
{
2032
$dlAnchor = new \Attrpubapi\Anchor();

tests/Entity/ApplicationProfileTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
use YotiTest\TestCase;
77
use Yoti\Entity\ApplicationProfile;
88

9+
/**
10+
* @coversDefaultClass \Yoti\Entity\ApplicationProfile
11+
*/
912
class ApplicationProfileTest extends TestCase
1013
{
1114
/**
@@ -24,6 +27,9 @@ public function setup()
2427
$this->dummyProfile = new ApplicationProfile($dummyData);
2528
}
2629

30+
/**
31+
* @covers ::getApplicationName
32+
*/
2733
public function testGetApplicationName()
2834
{
2935
$this->assertEquals(
@@ -32,6 +38,9 @@ public function testGetApplicationName()
3238
);
3339
}
3440

41+
/**
42+
* @covers ::getApplicationUrl
43+
*/
3544
public function testGetApplicationUrl()
3645
{
3746
$this->assertEquals(
@@ -40,6 +49,9 @@ public function testGetApplicationUrl()
4049
);
4150
}
4251

52+
/**
53+
* @covers ::getApplicationReceiptBgColor
54+
*/
4355
public function testGetApplicationReceiptBgColor()
4456
{
4557
$this->assertEquals(
@@ -48,6 +60,10 @@ public function testGetApplicationReceiptBgColor()
4860
);
4961
}
5062

63+
/**
64+
* @covers ::getApplicationLogo
65+
* @covers \Yoti\Entity\Image::getContent
66+
*/
5167
public function testGetApplicationLogoImageData()
5268
{
5369
$this->assertEquals(
@@ -56,6 +72,10 @@ public function testGetApplicationLogoImageData()
5672
);
5773
}
5874

75+
/**
76+
* @covers ::getApplicationLogo
77+
* @covers \Yoti\Entity\Image::getMimeType
78+
*/
5979
public function testGetApplicationLogoImageType()
6080
{
6181
$this->assertEquals(

tests/Entity/AttributeTest.php

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,15 @@
99
use YotiTest\Util\Profile\TestAnchors;
1010
use Yoti\Util\Profile\AnchorListConverter;
1111

12+
/**
13+
* @coversDefaultClass \Yoti\Entity\Attribute
14+
*/
1215
class AttributeTest extends TestCase
1316
{
1417
const ATTR_VALUE = 'Test FullName';
1518

1619
/**
17-
* @var Attribute
20+
* @var \Yoti\Entity\Attribute
1821
*/
1922
public $dummyAttribute;
2023

@@ -33,16 +36,25 @@ public function setup()
3336
);
3437
}
3538

39+
/**
40+
* @covers ::getName
41+
*/
3642
public function testAttributeName()
3743
{
3844
$this->assertEquals(Profile::ATTR_FULL_NAME, $this->dummyAttribute->getName());
3945
}
4046

47+
/**
48+
* @covers ::getValue
49+
*/
4150
public function testAttributeValue()
4251
{
4352
$this->assertEquals(self::ATTR_VALUE, $this->dummyAttribute->getValue());
4453
}
4554

55+
/**
56+
* @covers ::getSources
57+
*/
4658
public function testGetSources()
4759
{
4860
$sources = $this->dummyAttribute->getSources();
@@ -59,6 +71,9 @@ public function testGetSources()
5971
);
6072
}
6173

74+
/**
75+
* @covers ::getVerifiers
76+
*/
6277
public function testVerifiers()
6378
{
6479
$verifiers = $this->dummyAttribute->getVerifiers();
@@ -72,6 +87,9 @@ public function testVerifiers()
7287
);
7388
}
7489

90+
/**
91+
* @covers ::getAnchors
92+
*/
7593
public function testGetAnchors()
7694
{
7795
$anchors = $this->dummyAttribute->getAnchors();
@@ -84,6 +102,12 @@ public function testGetAnchors()
84102
$this->assertEquals('YOTI_ADMIN', $anchors[2]->getValue());
85103
}
86104

105+
/**
106+
* Convert anchor string to Protobuf Anchor
107+
*
108+
* @param string $anchorString
109+
* @return \Attrpubapi\Anchor
110+
*/
87111
public function convertToProtobufAnchor($anchorString)
88112
{
89113
$anchor = new \Attrpubapi\Anchor();

0 commit comments

Comments
 (0)