Skip to content

Commit 00c0930

Browse files
committed
Merge pull request #349
2 parents 0124ecf + 5fbcef0 commit 00c0930

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/MongoDB/Manager.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
#include "php_phongo.h"
4646
#include "php_bson.h"
4747

48+
#define PHONGO_MANAGER_URI_DEFAULT "mongodb://127.0.0.1/"
49+
4850
PHONGO_API zend_class_entry *php_phongo_manager_ce;
4951

5052
zend_object_handlers php_phongo_handler_manager;
@@ -76,7 +78,7 @@ PHP_METHOD(Manager, __construct)
7678
phongo_zval_to_bson(options, PHONGO_BSON_NONE, &bson_options, NULL TSRMLS_CC);
7779
}
7880

79-
phongo_manager_init(intern, uri_string, &bson_options, driverOptions TSRMLS_CC);
81+
phongo_manager_init(intern, uri_string ? uri_string : PHONGO_MANAGER_URI_DEFAULT, &bson_options, driverOptions TSRMLS_CC);
8082
bson_destroy(&bson_options);
8183
}
8284
/* }}} */

tests/manager/manager-ctor-003.phpt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
--TEST--
2+
MongoDB\Driver\Manager::__construct() URI defaults to "mongodb://127.0.0.1/"
3+
--SKIPIF--
4+
<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
5+
--FILE--
6+
<?php
7+
require_once __DIR__ . "/../utils/basic.inc";
8+
9+
ini_set('mongodb.debug', 'stderr');
10+
$manager = new MongoDB\Driver\Manager();
11+
ini_set('mongodb.debug', '');
12+
13+
?>
14+
===DONE===
15+
<?php exit(0); ?>
16+
--EXPECTF--
17+
[%s] PHONGO: DEBUG > Connection string: 'mongodb://127.0.0.1/'
18+
%A
19+
===DONE===

0 commit comments

Comments
 (0)