Task to increase test coverage for \Drupal\Component\Utility\Crypt.

See #1938068: [Meta] Convert UnitTestBase to PHPUnit.

Current test coverage: 62.07%

Files: 
CommentFileSizeAuthor
#9 crypt-phpunit-2046207-09.patch2.78 KBMile23
PASSED: [[SimpleTest]]: [MySQL] 58,304 pass(es).
[ View ]
#6 crypt-phpunit-2046207-06.patch2.78 KBMile23
PASSED: [[SimpleTest]]: [MySQL] 59,597 pass(es).
[ View ]
#3 interdiff.txt1.94 KBjhedstrom
#3 crypt-phpunit-2046207-03.patch2.21 KBjhedstrom
PASSED: [[SimpleTest]]: [MySQL] 57,499 pass(es).
[ View ]
#1 crypt-phpunit-2046207-01.patch2.2 KBjhedstrom
PASSED: [[SimpleTest]]: [MySQL] 57,185 pass(es).
[ View ]

Comments

Status:Active» Needs review
StatusFileSize
new2.2 KB
PASSED: [[SimpleTest]]: [MySQL] 57,185 pass(es).
[ View ]

This patch expands coverage to 75.86%. Not sure how to test the missed code, as it largely depends on environment setup, or on testing random strings, which I have not immediate thoughts on how to do.

Status:Needs review» Needs work

+++ b/core/tests/Drupal/Tests/Component/Utility/CryptTest.phpundefined
@@ -37,4 +37,53 @@ public function testRandomBytes() {
+  public function testHashBase64($data, $expectedHash) {
...
+  public function testHmacBase64($data, $key, $expectedHmac) {

parameters are not camelcased accoring to the drupal code style.

Status:Needs work» Needs review
StatusFileSize
new2.21 KB
PASSED: [[SimpleTest]]: [MySQL] 57,499 pass(es).
[ View ]
new1.94 KB

Removed the camel case vars.

+++ b/core/tests/Drupal/Tests/Component/Utility/CryptTest.phpundefined
@@ -37,4 +37,53 @@ public function testRandomBytes() {
+  public function testHmacBase64($data, $key, $expected_hmac) {
...
+  public static function providerTestHashBase64() {
...
+  public static function providerTestHmacBase64() {

It would be cool to have @param and @return for these methods, sorry :(

Status:Needs review» Needs work

StatusFileSize
new2.78 KB
PASSED: [[SimpleTest]]: [MySQL] 59,597 pass(es).
[ View ]

Took out 'static.'

Added @param and @return for methods without them.

Added @group.

Status:Needs work» Needs review

+++ b/core/tests/Drupal/Tests/Component/Utility/CryptTest.php
@@ -14,6 +14,9 @@
+ * ¶

Nitpick alarm: trailing space left.

StatusFileSize
new2.78 KB
PASSED: [[SimpleTest]]: [MySQL] 58,304 pass(es).
[ View ]

I blame NetBeans. I'll never get used to it.

Meanwhile back in Coda...

Status:Needs review» Reviewed & tested by the community

Great, thank you!

Status:Reviewed & tested by the community» Fixed

Committed 3b91bd1 and pushed to 8.x. Thanks!

Automatically closed -- issue fixed for 2 weeks with no activity.