Skip to content

Commit

Permalink
PHP 7.2 doesn't allow indenting nowdoc closing identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
jmikola committed Jul 10, 2023
1 parent af018f1 commit 847023d
Showing 1 changed file with 48 additions and 32 deletions.
80 changes: 48 additions & 32 deletions tests/ExamplesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,7 @@ public function testEncryptionExamples(string $file, string $expectedOutput): vo

public static function provideEncryptionExamples(): Generator
{
yield 'create_data_key' => [
'file' => __DIR__ . '/../docs/examples/create_data_key.php',
'expectedOutput' => <<<'OUTPUT'
$expectedOutput = <<<'OUTPUT'
MongoDB\BSON\Binary Object
(
[data] => %a
Expand All @@ -229,24 +227,28 @@ public static function provideEncryptionExamples(): Generator
[data] => %a
[type] => 6
)
OUTPUT,
OUTPUT;

yield 'create_data_key' => [
'file' => __DIR__ . '/../docs/examples/create_data_key.php',
'expectedOutput' => $expectedOutput,
];

yield 'key_alt_name' => [
'file' => __DIR__ . '/../docs/examples/key_alt_name.php',
'expectedOutput' => <<<'OUTPUT'
$expectedOutput = <<<'OUTPUT'
Error creating key: E11000 duplicate key error %s: encryption.__keyVault%sdup key: { keyAltNames: "myDataKey" }
MongoDB\BSON\Binary Object
(
[data] => %a
[type] => 6
)
OUTPUT,
OUTPUT;

yield 'key_alt_name' => [
'file' => __DIR__ . '/../docs/examples/key_alt_name.php',
'expectedOutput' => $expectedOutput,
];

yield 'csfle-automatic_encryption-local_schema' => [
'file' => __DIR__ . '/../docs/examples/csfle-automatic_encryption-local_schema.php',
'expectedOutput' => <<<'OUTPUT'
$expectedOutput = <<<'OUTPUT'
MongoDB\Model\BSONDocument Object
(
[storage:ArrayObject:private] => Array
Expand All @@ -271,12 +273,14 @@ public static function provideEncryptionExamples(): Generator
)
Error inserting document: Document failed validation
OUTPUT,
OUTPUT;

yield 'csfle-automatic_encryption-local_schema' => [
'file' => __DIR__ . '/../docs/examples/csfle-automatic_encryption-local_schema.php',
'expectedOutput' => $expectedOutput,
];

yield 'csfle-automatic_encryption-server_side_schema' => [
'file' => __DIR__ . '/../docs/examples/csfle-automatic_encryption-server_side_schema.php',
'expectedOutput' => <<<'OUTPUT'
$expectedOutput = <<<'OUTPUT'
MongoDB\Model\BSONDocument Object
(
[storage:ArrayObject:private] => Array
Expand All @@ -301,12 +305,14 @@ public static function provideEncryptionExamples(): Generator
)
Error inserting document: Document failed validation
OUTPUT,
OUTPUT;

yield 'csfle-automatic_encryption-server_side_schema' => [
'file' => __DIR__ . '/../docs/examples/csfle-automatic_encryption-server_side_schema.php',
'expectedOutput' => $expectedOutput,
];

yield 'csfle-explicit_encryption' => [
'file' => __DIR__ . '/../docs/examples/csfle-explicit_encryption.php',
'expectedOutput' => <<<'OUTPUT'
$expectedOutput = <<<'OUTPUT'
MongoDB\Model\BSONDocument Object
(
[storage:ArrayObject:private] => Array
Expand All @@ -322,12 +328,14 @@ public static function provideEncryptionExamples(): Generator
)
Decrypted: mySecret
OUTPUT,
OUTPUT;

yield 'csfle-explicit_encryption' => [
'file' => __DIR__ . '/../docs/examples/csfle-explicit_encryption.php',
'expectedOutput' => $expectedOutput,
];

yield 'csfle-explicit_encryption_automatic_decryption' => [
'file' => __DIR__ . '/../docs/examples/csfle-explicit_encryption_automatic_decryption.php',
'expectedOutput' => <<<'OUTPUT'
$expectedOutput = <<<'OUTPUT'
MongoDB\Model\BSONDocument Object
(
[storage:ArrayObject:private] => Array
Expand All @@ -337,7 +345,11 @@ public static function provideEncryptionExamples(): Generator
)
)
OUTPUT,
OUTPUT;

yield 'csfle-explicit_encryption_automatic_decryption' => [
'file' => __DIR__ . '/../docs/examples/csfle-explicit_encryption_automatic_decryption.php',
'expectedOutput' => $expectedOutput,
];
}

Expand All @@ -361,9 +373,7 @@ public function testQueryableEncryptionExamples(string $file, string $expectedOu

public static function provideQueryableEncryptionExamples(): Generator
{
yield 'queryable_encryption-automatic' => [
'file' => __DIR__ . '/../docs/examples/queryable_encryption-automatic.php',
'expectedOutput' => <<<'OUTPUT'
$expectedOutput = <<<'OUTPUT'
MongoDB\Model\BSONDocument Object
(
[storage:ArrayObject:private] => Array
Expand Down Expand Up @@ -422,12 +432,14 @@ public static function provideQueryableEncryptionExamples(): Generator
)
)
OUTPUT,
OUTPUT;

yield 'queryable_encryption-automatic' => [
'file' => __DIR__ . '/../docs/examples/queryable_encryption-automatic.php',
'expectedOutput' => $expectedOutput,
];

yield 'queryable_encryption-explicit' => [
'file' => __DIR__ . '/../docs/examples/queryable_encryption-explicit.php',
'expectedOutput' => <<<'OUTPUT'
$expectedOutput = <<<'OUTPUT'
MongoDB\Model\BSONDocument Object
(
[storage:ArrayObject:private] => Array
Expand All @@ -452,7 +464,11 @@ public static function provideQueryableEncryptionExamples(): Generator
)
)
OUTPUT,
OUTPUT;

yield 'queryable_encryption-explicit' => [
'file' => __DIR__ . '/../docs/examples/queryable_encryption-explicit.php',
'expectedOutput' => $expectedOutput,
];
}

Expand Down

0 comments on commit 847023d

Please sign in to comment.