Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/MongoDB/Manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
#include "php_phongo.h"
#include "php_bson.h"

#define PHONGO_MANAGER_URI_DEFAULT "mongodb://127.0.0.1/"

PHONGO_API zend_class_entry *php_phongo_manager_ce;

zend_object_handlers php_phongo_handler_manager;
Expand Down Expand Up @@ -76,7 +78,7 @@ PHP_METHOD(Manager, __construct)
phongo_zval_to_bson(options, PHONGO_BSON_NONE, &bson_options, NULL TSRMLS_CC);
}

phongo_manager_init(intern, uri_string, &bson_options, driverOptions TSRMLS_CC);
phongo_manager_init(intern, uri_string ? uri_string : PHONGO_MANAGER_URI_DEFAULT, &bson_options, driverOptions TSRMLS_CC);
bson_destroy(&bson_options);
}
/* }}} */
Expand Down
19 changes: 19 additions & 0 deletions tests/manager/manager-ctor-003.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
--TEST--
MongoDB\Driver\Manager::__construct() URI defaults to "mongodb://127.0.0.1/"
--SKIPIF--
<?php require __DIR__ . "/../utils/basic-skipif.inc"; CLEANUP(STANDALONE) ?>
--FILE--
<?php
require_once __DIR__ . "/../utils/basic.inc";

ini_set('mongodb.debug', 'stderr');
$manager = new MongoDB\Driver\Manager();
ini_set('mongodb.debug', '');

?>
===DONE===
<?php exit(0); ?>
--EXPECTF--
[%s] PHONGO: DEBUG > Connection string: 'mongodb://127.0.0.1/'
%A
===DONE===