Esempio n. 1
0
 public function TestInvalidISO8601Dates()
 {
     // "not a date" should fail to parse as a date.
     \Enhance\Assert::isNull(GetDeltaMillisecondsFromISO6801Dates("not a date", "1997-01-02"));
     \Enhance\Assert::isNull(GetDeltaMillisecondsFromISO6801Dates("1997-01-02", "not a date"));
     // Try a valid difference, to see that "not a date" is the reason we failed
     // above.
     \Enhance\Assert::isNotNull(GetDeltaMillisecondsFromISO6801Dates("1997-01-02", "1997-01-02"));
 }
Esempio n. 2
0
 public function TestGoogleDotComPCapFromDevice()
 {
     $consoleOut = array();
     $harFile = TMP . "/googleDotComFromDevice.har";
     $returnCode = ExecPcap2Har("unittests/data/googleDotComFromEmulator.pcap", $harFile, USE_LATEST_PCAP2HAR, SUPPRESS_PAGE_RECORDS, $consoleOut);
     \Enhance\Assert::areIdentical(print_r(array(), true), print_r($consoleOut, true));
     \Enhance\Assert::areIdentical(0, $returnCode);
     $harAsString = file_get_contents($harFile);
     $harAsPhpDict = json_decode($harAsString, true);
     \Enhance\Assert::isNotNull($harAsPhpDict);
     // Failed to parse as JSON
     // Test a few properties of the HAR, to see that it is well formed.
     \Enhance\Assert::areIdentical("1.1", $harAsPhpDict['log']['version']);
     // Older version of pcap2har see fewer requests, because packets arrive
     // out of the expected order.
     \Enhance\Assert::areIdentical(11, count($harAsPhpDict['log']['entries']));
 }