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

See #1938068: Convert UnitTestBase to PHPUnit.

Current test coverage: 62.07%

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jhedstrom’s picture

Status: Active » Needs review
FileSize
2.2 KB

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.

dawehner’s picture

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.

jhedstrom’s picture

Status: Needs work » Needs review
FileSize
2.21 KB
1.94 KB

Removed the camel case vars.

dawehner’s picture

+++ 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 :(

dawehner’s picture

Status: Needs review » Needs work
Mile23’s picture

Took out 'static.'

Added @param and @return for methods without them.

Added @group.

Mile23’s picture

Status: Needs work » Needs review
dawehner’s picture

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

Nitpick alarm: trailing space left.

Mile23’s picture

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

Meanwhile back in Coda...

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Great, thank you!

alexpott’s picture

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.

jhedstrom’s picture