Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vakata committed Dec 11, 2018
1 parent 6c8c629 commit c002134
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
14 changes: 7 additions & 7 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
|:-----------|:---------|
| public static | <strong>OIDtoText(</strong><em>mixed</em> <strong>$id</strong>)</strong> : <em>void</em> |
| public static | <strong>TextToOID(</strong><em>mixed</em> <strong>$text</strong>)</strong> : <em>void</em> |
| public static | <strong>fromBase256(</strong><em>string</em> <strong>$string</strong>, <em>integer</em> <strong>$base=10</strong>)</strong> : <em>integer the converted number</em><br /><em>Convert a number from base256</em> |
| public static | <strong>fromBase256(</strong><em>string</em> <strong>$string</strong>)</strong> : <em>integer/string the converted number</em><br /><em>Convert a number from base256</em> |
| public static | <strong>toBase256(</strong><em>integer</em> <strong>$number</strong>, <em>integer</em> <strong>$base=10</strong>)</strong> : <em>string the number in base256</em><br /><em>Convert a number to base256</em> |

<hr />
Expand All @@ -48,9 +48,9 @@
| public | <strong>__construct(</strong><em>[\vakata\asn1\Reader](#class-vakataasn1reader)</em> <strong>$reader</strong>)</strong> : <em>void</em><br /><em>Create an instance by passing in an instantiated reader.</em> |
| public static | <strong>fromFile(</strong><em>string</em> <strong>$path</strong>)</strong> : <em>[\vakata\asn1\Decoder](#class-vakataasn1decoder)</em><br /><em>Create a new instance from a file.</em> |
| public static | <strong>fromString(</strong><em>string</em> <strong>$data</strong>)</strong> : <em>[\vakata\asn1\Decoder](#class-vakataasn1decoder)</em><br /><em>Create a new instance from an ASN1 string.</em> |
| public | <strong>map(</strong><em>array</em> <strong>$map</strong>, <em>mixed</em> <strong>$skeleton=null</strong>)</strong> : <em>array</em><br /><em>Map the parsed data to a map</em> |
| public | <strong>structure(</strong><em>mixed</em> <strong>$max=null</strong>)</strong> : <em>array</em><br /><em>Dump the parsed structure of the ASN1 data.</em> |
| public | <strong>values(</strong><em>mixed</em> <strong>$skeleton=null</strong>)</strong> : <em>array</em><br /><em>Dump the parsed values only.</em> |
| public | <strong>map(</strong><em>array</em> <strong>$map</strong>, <em>mixed</em> <strong>$skeleton=null</strong>)</strong> : <em>mixed in most cases this is an array, as all complex structures are either a sequence or a set</em><br /><em>Map the parsed data to a map</em> |
| public | <strong>structure(</strong><em>mixed</em> <strong>$max=null</strong>)</strong> : <em>mixed in most cases this is an array, as all complex structures are either a sequence or a set</em><br /><em>Dump the parsed structure of the ASN1 data.</em> |
| public | <strong>values(</strong><em>mixed</em> <strong>$skeleton=null</strong>)</strong> : <em>mixed in most cases this is an array, as all complex structures are either a sequence or a set</em><br /><em>Dump the parsed values only.</em> |
| protected | <strong>decode(</strong><em>mixed</em> <strong>$header</strong>)</strong> : <em>void</em> |
| protected | <strong>header()</strong> : <em>void</em> |

Expand All @@ -62,7 +62,7 @@
| Visibility | Function |
|:-----------|:---------|
| public static | <strong>encode(</strong><em>mixed</em> <strong>$source</strong>, <em>array</em> <strong>$mapping</strong>)</strong> : <em>string raw DER output (base64_encode if needed)</em><br /><em>Encode some data to DER using a mapping array.</em> |
| public static | <strong>encode(</strong><em>mixed</em> <strong>$source</strong>, <em>array</em> <strong>$mapping</strong>)</strong> : <em>mixed raw DER output (base64_encode if needed), false on failure</em><br /><em>Encode some data to DER using a mapping array.</em> |
| protected static | <strong>length(</strong><em>mixed</em> <strong>$length</strong>)</strong> : <em>void</em> |

<hr />
Expand Down Expand Up @@ -162,7 +162,7 @@
| public static | <strong>fromFile(</strong><em>string</em> <strong>$path</strong>)</strong> : <em>[\vakata\asn1\structures\Structure](#class-vakataasn1structuresstructure-abstract)</em><br /><em>Create an instance from a file</em> |
| public static | <strong>fromString(</strong><em>string</em> <strong>$data</strong>)</strong> : <em>[\vakata\asn1\structures\Structure](#class-vakataasn1structuresstructure-abstract)</em><br /><em>Create an instance from a string.</em> |
| public | <strong>structure()</strong> : <em>array</em><br /><em>Output the raw ASN1 structure of the data.</em> |
| public | <strong>toArray(</strong><em>\boolean</em> <strong>$valuesOnly=false</strong>)</strong> : <em>void</em><br /><em>Get the mapped or values only view of the parsed data.</em> |
| public | <strong>toArray(</strong><em>\boolean</em> <strong>$valuesOnly=false</strong>)</strong> : <em>mixed</em><br /><em>Get the mapped or values only view of the parsed data.</em> |
| protected static | <strong>abstract map()</strong> : <em>void</em> |

<hr />
Expand All @@ -172,8 +172,8 @@
| Visibility | Function |
|:-----------|:---------|
| public static | <strong>generateFromData(</strong><em>string</em> <strong>$data</strong>, <em>bool/boolean/string</em> <strong>$nonce=true</strong>, <em>bool/boolean</em> <strong>$requireCert=false</strong>, <em>string</em> <strong>$alg=`'sha1'`</strong>, <em>string/null</em> <strong>$policy=null</strong>)</strong> : <em>string the raw timestamp request</em><br /><em>Generate a timestamp request (tsq) for a string</em> |
| public static | <strong>generateFromFile(</strong><em>string</em> <strong>$path</strong>, <em>bool/boolean/string</em> <strong>$nonce=true</strong>, <em>bool/boolean</em> <strong>$requireCert=false</strong>, <em>string</em> <strong>$alg=`'sha1'`</strong>, <em>string/null</em> <strong>$policy=null</strong>)</strong> : <em>string the raw timestamp request</em><br /><em>Generate a timestamp request (tsq) for a file path</em> |
| public static | <strong>generateFromHash(</strong><em>string</em> <strong>$data</strong>, <em>bool/boolean/string</em> <strong>$nonce=true</strong>, <em>bool/boolean</em> <strong>$requireCert=false</strong>, <em>string</em> <strong>$alg=`'sha1'`</strong>, <em>string/null</em> <strong>$policy=null</strong>)</strong> : <em>string the raw timestamp request</em><br /><em>Generate a timestamp request (tsq) for a given hash</em> |
| public static | <strong>generateRequestFromFile(</strong><em>string</em> <strong>$path</strong>, <em>bool/boolean/string</em> <strong>$nonce=true</strong>, <em>bool/boolean</em> <strong>$requireCert=false</strong>, <em>string</em> <strong>$alg=`'sha1'`</strong>, <em>string/null</em> <strong>$policy=null</strong>)</strong> : <em>string the raw timestamp request</em><br /><em>Generate a timestamp request (tsq) for a file path</em> |
| public static | <strong>map()</strong> : <em>void</em> |

*This class extends [\vakata\asn1\structures\Structure](#class-vakataasn1structuresstructure-abstract)*
Expand Down
28 changes: 14 additions & 14 deletions tests/ASN1Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,50 +77,50 @@ public function testEncodeDecode()
public function testCertificate()
{
$this->assertEquals(
file_get_contents(__DIR__ . '/samples/certificate.crt.dump'),
(string)Certificate::fromFile(__DIR__ . '/samples/certificate.crt')
str_replace("\r", "", file_get_contents(__DIR__ . '/samples/certificate.crt.dump')),
str_replace("\r", "", (string)Certificate::fromFile(__DIR__ . '/samples/certificate.crt'))
);
}
public function testCRL()
{
$this->assertEquals(
file_get_contents(__DIR__ . '/samples/revocation.crl.dump'),
(string)CRL::fromFile(__DIR__ . '/samples/revocation.crl')
str_replace("\r", "", file_get_contents(__DIR__ . '/samples/revocation.crl.dump')),
str_replace("\r", "", (string)CRL::fromFile(__DIR__ . '/samples/revocation.crl'))
);
}
public function testOCSPRequest()
{
$this->assertEquals(
file_get_contents(__DIR__ . '/samples/ocsp.req.dump'),
(string)OCSPRequest::fromFile(__DIR__ . '/samples/ocsp.req')
str_replace("\r", "", file_get_contents(__DIR__ . '/samples/ocsp.req.dump')),
str_replace("\r", "", (string)OCSPRequest::fromFile(__DIR__ . '/samples/ocsp.req'))
);
}
public function testOCSPResponse()
{
$this->assertEquals(
file_get_contents(__DIR__ . '/samples/ocsp.res.dump'),
(string)OCSPResponse::fromFile(__DIR__ . '/samples/ocsp.res')
str_replace("\r", "", file_get_contents(__DIR__ . '/samples/ocsp.res.dump')),
str_replace("\r", "", (string)OCSPResponse::fromFile(__DIR__ . '/samples/ocsp.res'))
);
}
public function testP7S()
{
$this->assertEquals(
file_get_contents(__DIR__ . '/samples/signed.p7s.dump'),
(string)P7S::fromFile(__DIR__ . '/samples/signed.p7s')
str_replace("\r", "", file_get_contents(__DIR__ . '/samples/signed.p7s.dump')),
str_replace("\r", "", (string)P7S::fromFile(__DIR__ . '/samples/signed.p7s'))
);
}
public function testTimestampRequest()
{
$this->assertEquals(
file_get_contents(__DIR__ . '/samples/timestamp.tsq.dump'),
(string)TimestampRequest::fromFile(__DIR__ . '/samples/timestamp.tsq')
str_replace("\r", "", file_get_contents(__DIR__ . '/samples/timestamp.tsq.dump')),
str_replace("\r", "", (string)TimestampRequest::fromFile(__DIR__ . '/samples/timestamp.tsq'))
);
}
public function testTimestampResponse()
{
$this->assertEquals(
file_get_contents(__DIR__ . '/samples/timestamp.tsr.dump'),
(string)TimestampResponse::fromFile(__DIR__ . '/samples/timestamp.tsr')
str_replace("\r", "", file_get_contents(__DIR__ . '/samples/timestamp.tsr.dump')),
str_replace("\r", "", (string)TimestampResponse::fromFile(__DIR__ . '/samples/timestamp.tsr'))
);
}
}

0 comments on commit c002134

Please sign in to comment.