From 7c2b399915a2d338fd2b64280fe47172624d8614 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 4 Sep 2014 22:26:37 +0200 Subject: [PATCH 1/3] ASN1Test: Also check the type by using assertSame instead of assertEquals. --- tests/Unit/File/ASN1Test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Unit/File/ASN1Test.php b/tests/Unit/File/ASN1Test.php index fa2b150e..71c9e0a6 100644 --- a/tests/Unit/File/ASN1Test.php +++ b/tests/Unit/File/ASN1Test.php @@ -241,7 +241,7 @@ class Unit_File_ASN1Test extends PhpseclibTestCase { $asn1 = new File_ASN1(); $decoded = $asn1->decodeBER(file_get_contents(dirname(__FILE__) . '/ASN1/FE.pdf.p7m')); - $this->assertEquals(count($decoded[0]['content'][1]['content'][0]['content']), 5); // older versions would have returned 3 + $this->assertSame(count($decoded[0]['content'][1]['content'][0]['content']), 5); // older versions would have returned 3 } public function testDefiniteLength() @@ -266,6 +266,6 @@ class Unit_File_ASN1Test extends PhpseclibTestCase 'IOkKcGQRCMha8X2e7GmlpdWC1ycenlbN0nbVeSv3JUMcafC4+Q=='; $asn1 = new File_ASN1(); $decoded = $asn1->decodeBER(base64_decode($str)); - $this->assertEquals(count($decoded[0]['content']), 3); + $this->assertSame(count($decoded[0]['content']), 3); } } From 8e3b83af56abce8f090f7b51617b080c488b0021 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 4 Sep 2014 22:27:33 +0200 Subject: [PATCH 2/3] ASN1Test: The expected value comes first in assertEquals/assertSame. --- tests/Unit/File/ASN1Test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Unit/File/ASN1Test.php b/tests/Unit/File/ASN1Test.php index 71c9e0a6..bcd5c8f7 100644 --- a/tests/Unit/File/ASN1Test.php +++ b/tests/Unit/File/ASN1Test.php @@ -241,7 +241,7 @@ class Unit_File_ASN1Test extends PhpseclibTestCase { $asn1 = new File_ASN1(); $decoded = $asn1->decodeBER(file_get_contents(dirname(__FILE__) . '/ASN1/FE.pdf.p7m')); - $this->assertSame(count($decoded[0]['content'][1]['content'][0]['content']), 5); // older versions would have returned 3 + $this->assertSame(5, count($decoded[0]['content'][1]['content'][0]['content'])); // older versions would have returned 3 } public function testDefiniteLength() @@ -266,6 +266,6 @@ class Unit_File_ASN1Test extends PhpseclibTestCase 'IOkKcGQRCMha8X2e7GmlpdWC1ycenlbN0nbVeSv3JUMcafC4+Q=='; $asn1 = new File_ASN1(); $decoded = $asn1->decodeBER(base64_decode($str)); - $this->assertSame(count($decoded[0]['content']), 3); + $this->assertSame(3, count($decoded[0]['content'])); } } From 9c3ce656f4c47286623b979cf26e76a641c51f45 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 4 Sep 2014 22:33:41 +0200 Subject: [PATCH 3/3] ASN1Test: Even better, use assertCount instead of assertSame. --- tests/Unit/File/ASN1Test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/Unit/File/ASN1Test.php b/tests/Unit/File/ASN1Test.php index bcd5c8f7..4565edbd 100644 --- a/tests/Unit/File/ASN1Test.php +++ b/tests/Unit/File/ASN1Test.php @@ -241,7 +241,7 @@ class Unit_File_ASN1Test extends PhpseclibTestCase { $asn1 = new File_ASN1(); $decoded = $asn1->decodeBER(file_get_contents(dirname(__FILE__) . '/ASN1/FE.pdf.p7m')); - $this->assertSame(5, count($decoded[0]['content'][1]['content'][0]['content'])); // older versions would have returned 3 + $this->assertCount(5, $decoded[0]['content'][1]['content'][0]['content']); // older versions would have returned 3 } public function testDefiniteLength() @@ -266,6 +266,6 @@ class Unit_File_ASN1Test extends PhpseclibTestCase 'IOkKcGQRCMha8X2e7GmlpdWC1ycenlbN0nbVeSv3JUMcafC4+Q=='; $asn1 = new File_ASN1(); $decoded = $asn1->decodeBER(base64_decode($str)); - $this->assertSame(3, count($decoded[0]['content'])); + $this->assertCount(3, $decoded[0]['content']); } }