Skip to content

Commit 3efb11c

Browse files
committed
PHPC-180: Rename constant and pass the cleanup uri explicitly
- Use the new connection string constant that includes auth - Call the cleanup routines explicitly when needed
1 parent 4f69303 commit 3efb11c

File tree

55 files changed

+97
-113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+97
-113
lines changed

tests/bson/bson-utcdatetime-001.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
--TEST--
22
BSON BSON\UTCDatetime #001
33
--SKIPIF--
4-
<?php require "tests/utils/basic-skipif.inc" ?>
4+
<?php require "tests/utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
55
--FILE--
66
<?php
77
require_once "tests/utils/basic.inc";
88

9-
$manager = new MongoDB\Driver\Manager(MONGODB_URI);
9+
$manager = new MongoDB\Driver\Manager(STANDALONE);
1010

1111
$utcdatetime = new BSON\UTCDatetime(1416445411987);
1212
$result = $manager->executeInsert(NS, array('_id' => 1, 'x' => $utcdatetime));

tests/bulk/write-0001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ MongoDB\Driver\BulkWrite: #001 Variety Bulk
66
<?php
77
require_once "tests/utils/basic.inc";
88

9-
$manager = new MongoDB\Driver\Manager(MONGODB_URI);
9+
$manager = new MongoDB\Driver\Manager(STANDALONE);
1010

1111
$bulk = new MongoDB\Driver\BulkWrite;
1212
var_dump($bulk);

tests/bulk/write-0002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ MongoDB\Driver\BulkWrite: #002 Get the generated ID
66
<?php
77
require_once "tests/utils/basic.inc";
88

9-
$manager = new MongoDB\Driver\Manager(MONGODB_URI);
9+
$manager = new MongoDB\Driver\Manager(STANDALONE);
1010

1111
$hannes = array("name" => "Hannes", "country" => "USA", "gender" => "male");
1212
$hayley = array("name" => "Hayley", "country" => "USA", "gender" => "female");

tests/connect/standalone-auth-0001.phpt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
--TEST--
22
Connect to MongoDB with using default auth mechanism
33
--SKIPIF--
4-
<?php require "tests/utils/basic-skipif.inc"?>
4+
<?php require "tests/utils/basic-skipif.inc"; CLEANUP(STANDALONE_AUTH) ?>
55
--FILE--
66
<?php
77
require_once "tests/utils/basic.inc";
88

9-
$username = "root";
10-
$password = "toor";
11-
$database = "admin";
12-
13-
$parsed = parse_url(MONGODB_STANDALONE_AUTH_URI);
14-
$dsn = sprintf("mongodb://%s:%s@%s:%d/%s", $username, $password, $parsed["host"], $parsed["port"], $database);
15-
$manager = new MongoDB\Driver\Manager($dsn);
9+
$manager = new MongoDB\Driver\Manager(STANDALONE_AUTH);
1610

1711
$bulk = new MongoDB\Driver\BulkWrite;
1812

tests/connect/standalone-auth-0002.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--TEST--
22
Connect to MongoDB with using default auth mechanism #002
33
--SKIPIF--
4-
<?php require "tests/utils/basic-skipif.inc"?>
4+
<?php require "tests/utils/basic-skipif.inc"; CLEANUP(STANDALONE_AUTH) ?>
55
--FILE--
66
<?php
77
require_once "tests/utils/basic.inc";
@@ -10,7 +10,7 @@ $username = "root";
1010
$password = "tooring";
1111
$database = "admin";
1212

13-
$parsed = parse_url(MONGODB_STANDALONE_AUTH_URI);
13+
$parsed = parse_url(STANDALONE_AUTH);
1414
$dsn = sprintf("mongodb://%s:%s@%s:%d/%s", $username, $password, $parsed["host"], $parsed["port"], $database);
1515
$manager = new MongoDB\Driver\Manager($dsn);
1616

tests/connect/standalone-plain-0001.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--TEST--
22
Connect to MongoDB with using PLAIN auth mechanism
33
--SKIPIF--
4-
<?php require "tests/utils/auth-plain-skipif.inc"?>
4+
<?php require "tests/utils/auth-plain-skipif.inc"; CLEANUP(STANDALONE_PLAIN) ?>
55
--FILE--
66
<?php
77
require_once "tests/utils/basic.inc";
@@ -10,7 +10,7 @@ $username = "root";
1010
$password = "toor";
1111
$database = "admin";
1212

13-
$parsed = parse_url(MONGODB_STANDALONE_PLAIN_URI);
13+
$parsed = parse_url(STANDALONE_PLAIN);
1414
$dsn = sprintf("mongodb://%s:%s@%s:%d/%s", $username, $password, $parsed["host"], $parsed["port"], $database);
1515
$adminmanager = new MongoDB\Driver\Manager($dsn);
1616

tests/connect/standalone-plain-0002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ $username = "root";
1010
$password = "toor";
1111
$database = "admin";
1212

13-
$parsed = parse_url(MONGODB_STANDALONE_PLAIN_URI);
13+
$parsed = parse_url(STANDALONE_PLAIN);
1414
$dsn = sprintf("mongodb://%s:%s@%s:%d/%s", $username, $password, $parsed["host"], $parsed["port"], $database);
1515
$adminmanager = new MongoDB\Driver\Manager($dsn);
1616

tests/connect/standalone-ssl-0001.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ $opts = array(
1616
);
1717
$context = stream_context_create($opts);
1818

19-
$dsn = sprintf("%s/?ssl=true", MONGODB_STANDALONE_SSL_URI);
19+
$dsn = sprintf("%s/?ssl=true", STANDALONE_SSL);
2020

2121
$manager = new MongoDB\Driver\Manager($dsn, array(), array("context" => $context));
2222

tests/connect/standalone-ssl-0002.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Connect to MongoDB with using SSL and verify the stream
66
<?php
77
require_once "tests/utils/basic.inc";
88

9-
$dsn = sprintf("%s/?ssl=true", MONGODB_STANDALONE_SSL_URI);
9+
$dsn = sprintf("%s/?ssl=true", STANDALONE_SSL);
1010

1111
$SSL_DIR = realpath(__DIR__ . "/" . "./../../scripts/ssl/");
1212
function isValid(array $cert) {

tests/connect/standalone-x509-0001.phpt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,8 @@ $opts = array(
2929
);
3030
$context = stream_context_create($opts);
3131

32-
$certusername = "C=US,ST=New York,L=New York City,O=MongoDB,OU=KernelUser,CN=client";
33-
34-
3532
try {
36-
$parsed = parse_url(MONGODB_STANDALONE_X509_URI);
37-
$dsn = sprintf("mongodb://%s@%s:%d/%s?ssl=true&authMechanism=MONGODB-X509", $certusername, $parsed["host"], $parsed["port"], DATABASE_NAME);
33+
$dsn = sprintf("%s&ssl=true", STANDALONE_X509);
3834

3935
$manager = new MongoDB\Driver\Manager($dsn, array(), array("context" => $context));
4036

0 commit comments

Comments
 (0)