@@ -48,45 +48,63 @@ public function testSynKey()
48
48
'Web keys successfully synchronized! ' , $ tester ->getDisplay ()
49
49
);
50
50
51
- // $certs = json_decode(file_get_contents($url));
52
- // $fpStorage = $this->container->get('vks.storage.fingerprint');
53
- // $keyidStorage = $this->container->get('vks.storage.keyid');
54
- // $emailStorage = $this->container->get('vks.storage.email');
55
- // $wkdStorage = $this->container->get('wkd.storage');
56
- // foreach ($certs as $cert) {
57
- // $this->assertTrue(
58
- // file_exists(implode([
59
- // $fpStorage,
60
- // DIRECTORY_SEPARATOR,
61
- // strtolower($cert->fingerprint),
62
- // ]))
63
- // );
64
- // $this->assertTrue(
65
- // file_exists(implode([
66
- // $keyidStorage,
67
- // DIRECTORY_SEPARATOR,
68
- // strtolower($cert->key_id),
69
- // ]))
70
- // );
71
- // $this->assertTrue(
72
- // file_exists(implode([
73
- // $wkdStorage,
74
- // DIRECTORY_SEPARATOR,
75
- // $cert->domain,
76
- // DIRECTORY_SEPARATOR,
77
- // $cert->wkd_hash,
78
- // ]))
79
- // );
51
+ if ($ directory = json_decode (file_get_contents ($ url ), true )) {
52
+ if (!empty ($ byFingerprints = $ directory ['fingerprint ' ] ?? [])) {
53
+ $ storage = $ this ->container ->get ('vks.storage.fingerprint ' );
54
+ foreach ($ byFingerprints as $ fingerprint => $ keyData ) {
55
+ $ this ->assertTrue (
56
+ file_exists (implode ([
57
+ $ storage ,
58
+ DIRECTORY_SEPARATOR ,
59
+ strtolower ($ fingerprint ),
60
+ ]))
61
+ );
62
+ }
63
+ }
80
64
81
- // $email = SyncKeyCommand::extractEmail($cert->primary_user);
82
- // $this->assertTrue(
83
- // file_exists(implode([
84
- // $emailStorage,
85
- // DIRECTORY_SEPARATOR,
86
- // $email,
87
- // ]))
88
- // );
89
- // }
65
+ if (!empty ($ byKeyIDs = $ directory ['keyid ' ] ?? [])) {
66
+ $ storage = $ this ->container ->get ('vks.storage.keyid ' );
67
+ foreach ($ byKeyIDs as $ keyID => $ keyData ) {
68
+ $ this ->assertTrue (
69
+ file_exists (implode ([
70
+ $ storage ,
71
+ DIRECTORY_SEPARATOR ,
72
+ strtolower ($ keyID ),
73
+ ]))
74
+ );
75
+ }
76
+ }
77
+
78
+ if (!empty ($ byEmails = $ directory ['email ' ] ?? [])) {
79
+ $ storage = $ this ->container ->get ('vks.storage.email ' );
80
+ foreach ($ byEmails as $ email => $ keyData ) {
81
+ $ this ->assertTrue (
82
+ file_exists (implode ([
83
+ $ storage ,
84
+ DIRECTORY_SEPARATOR ,
85
+ $ email ,
86
+ ]))
87
+ );
88
+ }
89
+ }
90
+
91
+ if (!empty ($ byDomains = $ directory ['domain ' ] ?? [])) {
92
+ $ storage = $ this ->container ->get ('wkd.storage ' );
93
+ foreach ($ byDomains as $ domain => $ wkdHashs ) {
94
+ foreach ($ wkdHashs as $ hash => $ keyData ) {
95
+ $ this ->assertTrue (
96
+ file_exists (implode ([
97
+ $ storage ,
98
+ DIRECTORY_SEPARATOR ,
99
+ $ domain ,
100
+ DIRECTORY_SEPARATOR ,
101
+ $ hash ,
102
+ ]))
103
+ );
104
+ }
105
+ }
106
+ }
107
+ }
90
108
91
109
$ server ->stop ();
92
110
}
0 commit comments