Skip to content

Commit 6ff0e4e

Browse files
committed
Remove docs from tests and tooling
1 parent efdba8c commit 6ff0e4e

File tree

6 files changed

+3
-332
lines changed

6 files changed

+3
-332
lines changed

.github/workflows/tests.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,11 @@ on:
77
- "v*.*"
88
- "master"
99
- "feature/*"
10-
paths-ignore:
11-
- "docs/**"
1210
push:
1311
branches:
1412
- "v*.*"
1513
- "master"
1614
- "feature/*"
17-
paths-ignore:
18-
- "docs/**"
1915

2016
env:
2117
# TODO: change to "stable" once 1.20.0 is released

CONTRIBUTING.md

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -172,31 +172,9 @@ New rules can be added to the `rector.php` configuration file.
172172

173173
## Documentation
174174

175-
Documentation for the library lives in the `docs/` directory and is built with
176-
tools in the related
177-
[mongodb/docs-php-library](https://github.com/mongodb/docs-php-library)
178-
repository. The tools repository is already configured to reference our sources.
179-
180-
That said, any changes to the documentation should be tested locally before
181-
committing. Follow the following steps to build the docs locally with the tools
182-
repository:
183-
184-
* Clone the
185-
[mongodb/docs-php-library](https://github.com/mongodb/docs-php-library) tools
186-
repository.
187-
* Create and activate Python 2.7 virtual environment if necessary.
188-
189-
```console
190-
$ virtualenv -p python2.7 venv
191-
$ source venv/bin/activate
192-
```
193-
* Install [giza](https://pypi.python.org/pypi/giza/) according to the instructions
194-
in the [mongodb/docs-tools](https://github.com/mongodb/docs-tools) README.
195-
* Sync your working copy of the documentation to the `source/` directory with
196-
`rsync -a --delete /path/to/mongo-php-library/docs/ source/`.
197-
* Build the documentation with `giza make publish`. You can suppress
198-
informational log messages with the `--level warning` option.
199-
* Generated documentation may be found in the `build/master/html` directory.
175+
Documentation for the library is maintained by the MongoDB docs team and is kept
176+
in the [mongodb/docs-php-library](https://github.com/mongodb/docs-php-library)
177+
repository.
200178

201179
## Releasing
202180

phpcs.xml.dist

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
<file>benchmark/src</file>
1313
<file>src</file>
14-
<file>docs/examples</file>
1514
<file>examples</file>
1615
<file>tests</file>
1716
<file>tools</file>
@@ -75,14 +74,6 @@
7574

7675
<!-- Disable forbidden annotation sniff as excluding @api from the list doesn't work -->
7776
<exclude name="SlevomatCodingStandard.Commenting.ForbiddenAnnotations.AnnotationForbidden" />
78-
79-
<!-- Example file using HTML templating -->
80-
<exclude name="Generic.Files.InlineHTML.Found">
81-
<exclude-pattern>docs/examples/*/index.php</exclude-pattern>
82-
</exclude>
83-
<exclude name="SlevomatCodingStandard.ControlStructures.BlockControlStructureSpacing.IncorrectLinesCountAfterControlStructure">
84-
<exclude-pattern>docs/examples/*/index.php</exclude-pattern>
85-
</exclude>
8677
</rule>
8778

8879

@@ -163,11 +154,4 @@
163154
<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
164155
<exclude-pattern>/tests/SpecTests/*/Prose*</exclude-pattern>
165156
</rule>
166-
167-
<!-- **************************************** -->
168-
<!-- Exclude certain rules for codec examples -->
169-
<!-- **************************************** -->
170-
<rule ref="PSR1.Classes.ClassDeclaration.MissingNamespace">
171-
<exclude-pattern>/docs/examples/codecs/</exclude-pattern>
172-
</rule>
173157
</ruleset>

psalm-baseline.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<files psalm-version="5.18.0@b113f3ed0259fd6e212d87c3df80eec95a6abf19">
3-
<file src="docs/examples/encryption/csfle-explicit_encryption.php">
4-
<MixedArgument>
5-
<code><![CDATA[$clientEncryption->decrypt($document->encryptedField)]]></code>
6-
</MixedArgument>
7-
</file>
83
<file src="examples/atlas_search.php">
94
<MixedArgument>
105
<code><![CDATA[$document['name']]]></code>

psalm.xml.dist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
>
1212
<projectFiles>
1313
<directory name="src" />
14-
<directory name="docs/examples/encryption" />
1514
<directory name="examples" />
1615
<ignoreFiles>
1716
<directory name="vendor" />
@@ -39,7 +38,6 @@
3938
<RiskyTruthyFalsyComparison>
4039
<errorLevel type="suppress">
4140
<directory name="examples" />
42-
<directory name="docs/examples" />
4341
</errorLevel>
4442
</RiskyTruthyFalsyComparison>
4543
</issueHandlers>

tests/ExamplesTest.php

Lines changed: 0 additions & 280 deletions
Original file line numberDiff line numberDiff line change
@@ -302,286 +302,6 @@ public function testWithTransaction(): void
302302
$this->assertExampleOutput(__DIR__ . '/../examples/with_transaction.php', $expectedOutput);
303303
}
304304

305-
/** @dataProvider provideEncryptionExamples */
306-
public function testEncryptionExamples(string $file, string $expectedOutput): void
307-
{
308-
$this->skipIfClientSideEncryptionIsNotSupported();
309-
310-
/* Ensure that the key vault, collection under test, and any metadata
311-
* collections are cleaned up before and after the example is run. */
312-
$this->dropCollection('test', 'coll', ['encryptedFields' => []]);
313-
$this->dropCollection('encryption', '__keyVault');
314-
315-
/* Ensure the key vault has a partial, unique index for keyAltNames. The
316-
* key management examples already do this, so this is mainly for the
317-
* benefit of other scripts. */
318-
$this->setUpKeyVaultIndex();
319-
320-
$this->assertExampleOutput($file, $expectedOutput);
321-
}
322-
323-
public static function provideEncryptionExamples(): Generator
324-
{
325-
$expectedOutput = <<<'OUTPUT'
326-
MongoDB\BSON\Binary Object
327-
(
328-
[data] => %a
329-
[type] => 4
330-
)
331-
MongoDB\BSON\Binary Object
332-
(
333-
[data] => %a
334-
[type] => 6
335-
)
336-
OUTPUT;
337-
338-
yield 'create_data_key' => [
339-
'file' => __DIR__ . '/../docs/examples/encryption/create_data_key.php',
340-
'expectedOutput' => $expectedOutput,
341-
];
342-
343-
$expectedOutput = <<<'OUTPUT'
344-
Error creating key: E11000 duplicate key error %s: encryption.__keyVault%sdup key: { keyAltNames: "myDataKey" }
345-
MongoDB\BSON\Binary Object
346-
(
347-
[data] => %a
348-
[type] => 6
349-
)
350-
OUTPUT;
351-
352-
yield 'key_alt_name' => [
353-
'file' => __DIR__ . '/../docs/examples/encryption/key_alt_name.php',
354-
'expectedOutput' => $expectedOutput,
355-
];
356-
357-
$expectedOutput = <<<'OUTPUT'
358-
MongoDB\Model\BSONDocument Object
359-
(
360-
[storage:ArrayObject:private] => Array
361-
(
362-
[_id] => 1
363-
[encryptedField] => mySecret
364-
)
365-
366-
)
367-
MongoDB\Model\BSONDocument Object
368-
(
369-
[storage:ArrayObject:private] => Array
370-
(
371-
[_id] => 1
372-
[encryptedField] => MongoDB\BSON\Binary Object
373-
(
374-
[data] => %a
375-
[type] => 6
376-
)
377-
378-
)
379-
380-
)
381-
Error inserting document: Document failed validation
382-
OUTPUT;
383-
384-
yield 'csfle-automatic_encryption-local_schema' => [
385-
'file' => __DIR__ . '/../docs/examples/encryption/csfle-automatic_encryption-local_schema.php',
386-
'expectedOutput' => $expectedOutput,
387-
];
388-
389-
$expectedOutput = <<<'OUTPUT'
390-
MongoDB\Model\BSONDocument Object
391-
(
392-
[storage:ArrayObject:private] => Array
393-
(
394-
[_id] => 1
395-
[encryptedField] => mySecret
396-
)
397-
398-
)
399-
MongoDB\Model\BSONDocument Object
400-
(
401-
[storage:ArrayObject:private] => Array
402-
(
403-
[_id] => 1
404-
[encryptedField] => MongoDB\BSON\Binary Object
405-
(
406-
[data] => %a
407-
[type] => 6
408-
)
409-
410-
)
411-
412-
)
413-
Error inserting document: Document failed validation
414-
OUTPUT;
415-
416-
yield 'csfle-automatic_encryption-server_side_schema' => [
417-
'file' => __DIR__ . '/../docs/examples/encryption/csfle-automatic_encryption-server_side_schema.php',
418-
'expectedOutput' => $expectedOutput,
419-
];
420-
421-
$expectedOutput = <<<'OUTPUT'
422-
MongoDB\Model\BSONDocument Object
423-
(
424-
[storage:ArrayObject:private] => Array
425-
(
426-
[_id] => 1
427-
[encryptedField] => MongoDB\BSON\Binary Object
428-
(
429-
[data] => %a
430-
[type] => 6
431-
)
432-
433-
)
434-
435-
)
436-
Decrypted: mySecret
437-
OUTPUT;
438-
439-
yield 'csfle-explicit_encryption' => [
440-
'file' => __DIR__ . '/../docs/examples/encryption/csfle-explicit_encryption.php',
441-
'expectedOutput' => $expectedOutput,
442-
];
443-
444-
$expectedOutput = <<<'OUTPUT'
445-
MongoDB\Model\BSONDocument Object
446-
(
447-
[storage:ArrayObject:private] => Array
448-
(
449-
[_id] => 1
450-
[encryptedField] => mySecret
451-
)
452-
453-
)
454-
OUTPUT;
455-
456-
yield 'csfle-explicit_encryption_automatic_decryption' => [
457-
'file' => __DIR__ . '/../docs/examples/encryption/csfle-explicit_encryption_automatic_decryption.php',
458-
'expectedOutput' => $expectedOutput,
459-
];
460-
}
461-
462-
/** @dataProvider provideQueryableEncryptionExamples */
463-
public function testQueryableEncryptionExamples(string $file, string $expectedOutput): void
464-
{
465-
$this->skipIfClientSideEncryptionIsNotSupported();
466-
467-
$this->skipIfServerVersion('<', '7.0.0', 'Queryable encryption tests require MongoDB 7.0 or later');
468-
469-
if ($this->isStandalone()) {
470-
$this->markTestSkipped('Queryable encryption requires replica sets');
471-
}
472-
473-
/* Ensure that the key vault, collection under test, and any metadata
474-
* collections are cleaned up before and after the example is run. */
475-
$this->dropCollection('test', 'coll', ['encryptedFields' => []]);
476-
$this->dropCollection('encryption', '__keyVault');
477-
478-
// Ensure the key vault has a partial, unique index for keyAltNames
479-
$this->setUpKeyVaultIndex();
480-
481-
$this->assertExampleOutput($file, $expectedOutput);
482-
}
483-
484-
public static function provideQueryableEncryptionExamples(): Generator
485-
{
486-
$expectedOutput = <<<'OUTPUT'
487-
MongoDB\Model\BSONDocument Object
488-
(
489-
[storage:ArrayObject:private] => Array
490-
(
491-
[_id] => 1
492-
[encryptedIndexed] => indexedValue
493-
[encryptedUnindexed] => unindexedValue
494-
[__safeContent__] => MongoDB\Model\BSONArray Object
495-
(
496-
[storage:ArrayObject:private] => Array
497-
(
498-
[0] => MongoDB\BSON\Binary Object
499-
(
500-
[data] => %a
501-
[type] => 0
502-
)
503-
504-
)
505-
506-
)
507-
508-
)
509-
510-
)
511-
MongoDB\Model\BSONDocument Object
512-
(
513-
[storage:ArrayObject:private] => Array
514-
(
515-
[_id] => 1
516-
[encryptedIndexed] => MongoDB\BSON\Binary Object
517-
(
518-
[data] => %a
519-
[type] => 6
520-
)
521-
522-
[encryptedUnindexed] => MongoDB\BSON\Binary Object
523-
(
524-
[data] => %a
525-
[type] => 6
526-
)
527-
528-
[__safeContent__] => MongoDB\Model\BSONArray Object
529-
(
530-
[storage:ArrayObject:private] => Array
531-
(
532-
[0] => MongoDB\BSON\Binary Object
533-
(
534-
[data] => %a
535-
[type] => 0
536-
)
537-
538-
)
539-
540-
)
541-
542-
)
543-
544-
)
545-
OUTPUT;
546-
547-
yield 'queryable_encryption-automatic' => [
548-
'file' => __DIR__ . '/../docs/examples/encryption/queryable_encryption-automatic.php',
549-
'expectedOutput' => $expectedOutput,
550-
];
551-
552-
$expectedOutput = <<<'OUTPUT'
553-
MongoDB\Model\BSONDocument Object
554-
(
555-
[storage:ArrayObject:private] => Array
556-
(
557-
[_id] => 1
558-
[encryptedIndexed] => indexedValue
559-
[encryptedUnindexed] => unindexedValue
560-
[__safeContent__] => MongoDB\Model\BSONArray Object
561-
(
562-
[storage:ArrayObject:private] => Array
563-
(
564-
[0] => MongoDB\BSON\Binary Object
565-
(
566-
[data] => %a
567-
[type] => 0
568-
)
569-
570-
)
571-
572-
)
573-
574-
)
575-
576-
)
577-
OUTPUT;
578-
579-
yield 'queryable_encryption-explicit' => [
580-
'file' => __DIR__ . '/../docs/examples/encryption/queryable_encryption-explicit.php',
581-
'expectedOutput' => $expectedOutput,
582-
];
583-
}
584-
585305
private function assertExampleOutput(string $file, string $expectedOutput): void
586306
{
587307
require $file;

0 commit comments

Comments
 (0)