From 48329b4eb65301af3b4f2b6dff6aff5737576510 Mon Sep 17 00:00:00 2001 From: Andreas Braun Date: Thu, 10 Oct 2019 11:12:36 +0200 Subject: [PATCH] PHPC-1449: Resync bson-corpus tests to fix duplicate test names --- tests/bson-corpus/array-valid-003.phpt | 2 +- tests/bson-corpus/array-valid-004.phpt | 2 +- tests/bson-corpus/array-valid-005.phpt | 40 +++++++++++++++++++++++ tests/bson-corpus/datetime-valid-005.phpt | 40 +++++++++++++++++++++++ 4 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 tests/bson-corpus/array-valid-005.phpt create mode 100644 tests/bson-corpus/datetime-valid-005.phpt diff --git a/tests/bson-corpus/array-valid-003.phpt b/tests/bson-corpus/array-valid-003.phpt index d4bb4c4c9..be1e37063 100644 --- a/tests/bson-corpus/array-valid-003.phpt +++ b/tests/bson-corpus/array-valid-003.phpt @@ -1,5 +1,5 @@ --TEST-- -Array: Single Element Array with index set incorrectly +Array: Single Element Array with index set incorrectly to empty string --DESCRIPTION-- Generated by scripts/convert-bson-corpus-tests.php diff --git a/tests/bson-corpus/array-valid-004.phpt b/tests/bson-corpus/array-valid-004.phpt index 3e25a5ecc..f51e187c1 100644 --- a/tests/bson-corpus/array-valid-004.phpt +++ b/tests/bson-corpus/array-valid-004.phpt @@ -1,5 +1,5 @@ --TEST-- -Array: Single Element Array with index set incorrectly +Array: Single Element Array with index set incorrectly to ab --DESCRIPTION-- Generated by scripts/convert-bson-corpus-tests.php diff --git a/tests/bson-corpus/array-valid-005.phpt b/tests/bson-corpus/array-valid-005.phpt new file mode 100644 index 000000000..a0905868b --- /dev/null +++ b/tests/bson-corpus/array-valid-005.phpt @@ -0,0 +1,40 @@ +--TEST-- +Array: Multi Element Array with duplicate indexes +--DESCRIPTION-- +Generated by scripts/convert-bson-corpus-tests.php + +DO NOT EDIT THIS FILE +--FILE-- + Native -> Canonical BSON +echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n"; + +// Canonical BSON -> Canonical extJSON +echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n"; + +// Canonical extJSON -> Canonical BSON +echo bin2hex(fromJSON($canonicalExtJson)), "\n"; + +// Degenerate BSON -> Native -> Canonical BSON +echo bin2hex(fromPHP(toPHP($degenerateBson))), "\n"; + +// Degenerate BSON -> Canonical extJSON +echo json_canonicalize(toCanonicalExtendedJSON($degenerateBson)), "\n"; + +?> +===DONE=== + +--EXPECT-- +1b000000046100130000001030000a000000103100140000000000 +{"a":[{"$numberInt":"10"},{"$numberInt":"20"}]} +1b000000046100130000001030000a000000103100140000000000 +1b000000046100130000001030000a000000103100140000000000 +{"a":[{"$numberInt":"10"},{"$numberInt":"20"}]} +===DONE=== \ No newline at end of file diff --git a/tests/bson-corpus/datetime-valid-005.phpt b/tests/bson-corpus/datetime-valid-005.phpt new file mode 100644 index 000000000..d33942fcc --- /dev/null +++ b/tests/bson-corpus/datetime-valid-005.phpt @@ -0,0 +1,40 @@ +--TEST-- +DateTime: leading zero ms +--DESCRIPTION-- +Generated by scripts/convert-bson-corpus-tests.php + +DO NOT EDIT THIS FILE +--FILE-- + Native -> Canonical BSON +echo bin2hex(fromPHP(toPHP($canonicalBson))), "\n"; + +// Canonical BSON -> Canonical extJSON +echo json_canonicalize(toCanonicalExtendedJSON($canonicalBson)), "\n"; + +// Canonical BSON -> Relaxed extJSON +echo json_canonicalize(toRelaxedExtendedJSON($canonicalBson)), "\n"; + +// Canonical extJSON -> Canonical BSON +echo bin2hex(fromJSON($canonicalExtJson)), "\n"; + +// Relaxed extJSON -> BSON -> Relaxed extJSON +echo json_canonicalize(toRelaxedExtendedJSON(fromJSON($relaxedExtJson))), "\n"; + +?> +===DONE=== + +--EXPECT-- +10000000096100d1d6d6cc3b01000000 +{"a":{"$date":{"$numberLong":"1356351330001"}}} +{"a":{"$date":"2012-12-24T12:15:30.001Z"}} +10000000096100d1d6d6cc3b01000000 +{"a":{"$date":"2012-12-24T12:15:30.001Z"}} +===DONE=== \ No newline at end of file