Skip to content

Commit d66e0e7

Browse files
committed
Merge pull request #701
2 parents b0a4735 + ecaeb2c commit d66e0e7

33 files changed

+403
-403
lines changed

tests/apm/monitoring-addSubscriber-001.phpt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ $m = new MongoDB\Driver\Manager(STANDALONE);
1010

1111
class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber
1212
{
13-
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
14-
{
15-
echo "- started: ", $event->getCommandName(), "\n";
16-
}
17-
18-
public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event )
19-
{
20-
}
21-
22-
public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
23-
{
24-
}
13+
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
14+
{
15+
echo "- started: ", $event->getCommandName(), "\n";
16+
}
17+
18+
public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event )
19+
{
20+
}
21+
22+
public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
23+
{
24+
}
2525
}
2626

2727
CLEANUP( STANDALONE );

tests/apm/monitoring-addSubscriber-002.phpt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ $m = new MongoDB\Driver\Manager(STANDALONE);
1010

1111
class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber
1212
{
13-
private $instanceName;
13+
private $instanceName;
1414

15-
public function __construct( $instanceName )
16-
{
17-
$this->instanceName = $instanceName;
18-
}
15+
public function __construct( $instanceName )
16+
{
17+
$this->instanceName = $instanceName;
18+
}
1919

20-
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
21-
{
22-
echo "- ({$this->instanceName}) - started: ", $event->getCommandName(), "\n";
23-
}
20+
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
21+
{
22+
echo "- ({$this->instanceName}) - started: ", $event->getCommandName(), "\n";
23+
}
2424

25-
public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event )
26-
{
27-
}
25+
public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event )
26+
{
27+
}
2828

29-
public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
30-
{
31-
}
29+
public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
30+
{
31+
}
3232
}
3333

3434
CLEANUP( STANDALONE );

tests/apm/monitoring-addSubscriber-003.phpt

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ $m = new MongoDB\Driver\Manager(STANDALONE);
1010

1111
class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber
1212
{
13-
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
14-
{
15-
echo "- started: ", $event->getCommandName(), "\n";
16-
}
17-
18-
public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event )
19-
{
20-
}
21-
22-
public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
23-
{
24-
}
13+
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
14+
{
15+
echo "- started: ", $event->getCommandName(), "\n";
16+
}
17+
18+
public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event )
19+
{
20+
}
21+
22+
public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
23+
{
24+
}
2525
}
2626

2727
$query = new MongoDB\Driver\Query( [] );

tests/apm/monitoring-addSubscriber-004.phpt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ $m = new MongoDB\Driver\Manager(STANDALONE);
1010

1111
class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber
1212
{
13-
private $instanceName;
13+
private $instanceName;
1414

15-
public function __construct( $instanceName )
16-
{
17-
$this->instanceName = $instanceName;
18-
}
15+
public function __construct( $instanceName )
16+
{
17+
$this->instanceName = $instanceName;
18+
}
1919

20-
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
21-
{
22-
echo "- ({$this->instanceName}) - started: ", $event->getCommandName(), "\n";
23-
}
20+
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
21+
{
22+
echo "- ({$this->instanceName}) - started: ", $event->getCommandName(), "\n";
23+
}
2424

25-
public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event )
26-
{
27-
}
25+
public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event )
26+
{
27+
}
2828

29-
public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
30-
{
31-
}
29+
public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
30+
{
31+
}
3232
}
3333

3434
CLEANUP( STANDALONE );

tests/apm/monitoring-commandFailed-001.phpt

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,29 @@ $m = new MongoDB\Driver\Manager(STANDALONE);
1010

1111
class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber
1212
{
13-
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
14-
{
15-
echo "started: ", $event->getCommandName(), "\n";
16-
}
13+
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
14+
{
15+
echo "started: ", $event->getCommandName(), "\n";
16+
}
1717

18-
public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event )
19-
{
20-
}
18+
public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event )
19+
{
20+
}
2121

22-
public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
23-
{
24-
echo "failed: ", $event->getCommandName(), "\n";
25-
echo "- getError() returns an object: ", is_object( $event->getError() ) ? 'yes' : 'no', "\n";
26-
echo "- getError() returns an MongoDB\Driver\Exception\Exception object: ", $event->getError() instanceof MongoDB\Driver\Exception\Exception ? 'yes' : 'no', "\n";
27-
echo "- getDurationMicros() returns an integer: ", is_integer( $event->getDurationMicros() ) ? 'yes' : 'no', "\n";
28-
echo "- getDurationMicros() returns > 0: ", $event->getDurationMicros() > 0 ? 'yes' : 'no', "\n";
29-
echo "- getCommandName() returns a string: ", is_string( $event->getCommandName() ) ? 'yes' : 'no', "\n";
30-
echo "- getCommandName() returns '", $event->getCommandName(), "'\n";
31-
echo "- getServer() returns an object: ", is_object( $event->getServer() ) ? 'yes' : 'no', "\n";
32-
echo "- getServer() returns a Server object: ", $event->getServer() instanceof MongoDB\Driver\Server ? 'yes' : 'no', "\n";
33-
echo "- getOperationId() returns a string: ", is_string( $event->getOperationId() ) ? 'yes' : 'no', "\n";
34-
echo "- getRequestId() returns a string: ", is_string( $event->getRequestId() ) ? 'yes' : 'no', "\n";
35-
}
22+
public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
23+
{
24+
echo "failed: ", $event->getCommandName(), "\n";
25+
echo "- getError() returns an object: ", is_object( $event->getError() ) ? 'yes' : 'no', "\n";
26+
echo "- getError() returns an MongoDB\Driver\Exception\Exception object: ", $event->getError() instanceof MongoDB\Driver\Exception\Exception ? 'yes' : 'no', "\n";
27+
echo "- getDurationMicros() returns an integer: ", is_integer( $event->getDurationMicros() ) ? 'yes' : 'no', "\n";
28+
echo "- getDurationMicros() returns > 0: ", $event->getDurationMicros() > 0 ? 'yes' : 'no', "\n";
29+
echo "- getCommandName() returns a string: ", is_string( $event->getCommandName() ) ? 'yes' : 'no', "\n";
30+
echo "- getCommandName() returns '", $event->getCommandName(), "'\n";
31+
echo "- getServer() returns an object: ", is_object( $event->getServer() ) ? 'yes' : 'no', "\n";
32+
echo "- getServer() returns a Server object: ", $event->getServer() instanceof MongoDB\Driver\Server ? 'yes' : 'no', "\n";
33+
echo "- getOperationId() returns a string: ", is_string( $event->getOperationId() ) ? 'yes' : 'no', "\n";
34+
echo "- getRequestId() returns a string: ", is_string( $event->getRequestId() ) ? 'yes' : 'no', "\n";
35+
}
3636
}
3737

3838
$subscriber = new MySubscriber;

tests/apm/monitoring-commandFailed-002.phpt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ $m = new MongoDB\Driver\Manager(STANDALONE);
1010

1111
class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber
1212
{
13-
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
14-
{
15-
echo "started: ", $event->getCommandName(), "\n";
16-
$this->startRequestId = $event->getRequestId();
17-
$this->startOperationId = $event->getOperationId();
18-
}
13+
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
14+
{
15+
echo "started: ", $event->getCommandName(), "\n";
16+
$this->startRequestId = $event->getRequestId();
17+
$this->startOperationId = $event->getOperationId();
18+
}
1919

20-
public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event )
21-
{
22-
}
20+
public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event )
21+
{
22+
}
2323

24-
public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
25-
{
26-
echo "failed: ", $event->getCommandName(), "\n";
27-
echo "- requestId matches: ", $this->startRequestId == $event->getRequestId() ? 'yes' : 'no', " \n";
28-
echo "- operationId matches: ", $this->startOperationId == $event->getOperationId() ? 'yes' : 'no', " \n";
29-
}
24+
public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
25+
{
26+
echo "failed: ", $event->getCommandName(), "\n";
27+
echo "- requestId matches: ", $this->startRequestId == $event->getRequestId() ? 'yes' : 'no', " \n";
28+
echo "- operationId matches: ", $this->startOperationId == $event->getOperationId() ? 'yes' : 'no', " \n";
29+
}
3030
}
3131

3232
$query = new MongoDB\Driver\Query( [] );

tests/apm/monitoring-commandStarted-001.phpt

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,28 @@ $m = new MongoDB\Driver\Manager(STANDALONE);
1010

1111
class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber
1212
{
13-
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
14-
{
15-
echo "started: ", $event->getCommandName(), "\n";
16-
echo "- getCommand() returns an object: ", is_object( $event->getCommand() ) ? 'yes' : 'no', "\n";
17-
echo "- getCommand() returns a stdClass object: ", $event->getCommand() instanceof stdClass ? 'yes' : 'no', "\n";
18-
echo "- getDatabaseName() returns a string: ", is_string( $event->getDatabaseName() ) ? 'yes' : 'no', "\n";
19-
echo "- getDatabaseName() returns '", $event->getDatabaseName(), "'\n";
20-
echo "- getCommandName() returns a string: ", is_string( $event->getCommandName() ) ? 'yes' : 'no', "\n";
21-
echo "- getCommandName() returns '", $event->getCommandName(), "'\n";
22-
echo "- getServer() returns an object: ", is_object( $event->getServer() ) ? 'yes' : 'no', "\n";
23-
echo "- getServer() returns a Server object: ", $event->getServer() instanceof MongoDB\Driver\Server ? 'yes' : 'no', "\n";
24-
echo "- getOperationId() returns a string: ", is_string( $event->getOperationId() ) ? 'yes' : 'no', "\n";
25-
echo "- getRequestId() returns a string: ", is_string( $event->getRequestId() ) ? 'yes' : 'no', "\n";
26-
}
13+
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
14+
{
15+
echo "started: ", $event->getCommandName(), "\n";
16+
echo "- getCommand() returns an object: ", is_object( $event->getCommand() ) ? 'yes' : 'no', "\n";
17+
echo "- getCommand() returns a stdClass object: ", $event->getCommand() instanceof stdClass ? 'yes' : 'no', "\n";
18+
echo "- getDatabaseName() returns a string: ", is_string( $event->getDatabaseName() ) ? 'yes' : 'no', "\n";
19+
echo "- getDatabaseName() returns '", $event->getDatabaseName(), "'\n";
20+
echo "- getCommandName() returns a string: ", is_string( $event->getCommandName() ) ? 'yes' : 'no', "\n";
21+
echo "- getCommandName() returns '", $event->getCommandName(), "'\n";
22+
echo "- getServer() returns an object: ", is_object( $event->getServer() ) ? 'yes' : 'no', "\n";
23+
echo "- getServer() returns a Server object: ", $event->getServer() instanceof MongoDB\Driver\Server ? 'yes' : 'no', "\n";
24+
echo "- getOperationId() returns a string: ", is_string( $event->getOperationId() ) ? 'yes' : 'no', "\n";
25+
echo "- getRequestId() returns a string: ", is_string( $event->getRequestId() ) ? 'yes' : 'no', "\n";
26+
}
2727

28-
public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event )
29-
{
30-
}
28+
public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event )
29+
{
30+
}
3131

32-
public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
33-
{
34-
}
32+
public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
33+
{
34+
}
3535
}
3636

3737
$query = new MongoDB\Driver\Query( [] );

tests/apm/monitoring-commandSucceeded-001.phpt

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,29 @@ $m = new MongoDB\Driver\Manager(STANDALONE);
1010

1111
class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber
1212
{
13-
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
14-
{
15-
echo "started: ", $event->getCommandName(), "\n";
16-
}
13+
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
14+
{
15+
echo "started: ", $event->getCommandName(), "\n";
16+
}
1717

18-
public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event )
19-
{
20-
echo "succeeded: ", $event->getCommandName(), "\n";
21-
echo "- getReply() returns an object: ", is_object( $event->getReply() ) ? 'yes' : 'no', "\n";
22-
echo "- getReply() returns a stdClass object: ", $event->getReply() instanceof stdClass ? 'yes' : 'no', "\n";
23-
echo "- getDurationMicros() returns an integer: ", is_integer( $event->getDurationMicros() ) ? 'yes' : 'no', "\n";
24-
echo "- getDurationMicros() returns > 0: ", $event->getDurationMicros() > 0 ? 'yes' : 'no', "\n";
25-
echo "- getCommandName() returns a string: ", is_string( $event->getCommandName() ) ? 'yes' : 'no', "\n";
26-
echo "- getCommandName() returns '", $event->getCommandName(), "'\n";
27-
echo "- getServer() returns an object: ", is_object( $event->getServer() ) ? 'yes' : 'no', "\n";
28-
echo "- getServer() returns a Server object: ", $event->getServer() instanceof MongoDB\Driver\Server ? 'yes' : 'no', "\n";
29-
echo "- getOperationId() returns a string: ", is_string( $event->getOperationId() ) ? 'yes' : 'no', "\n";
30-
echo "- getRequestId() returns a string: ", is_string( $event->getRequestId() ) ? 'yes' : 'no', "\n";
31-
}
18+
public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event )
19+
{
20+
echo "succeeded: ", $event->getCommandName(), "\n";
21+
echo "- getReply() returns an object: ", is_object( $event->getReply() ) ? 'yes' : 'no', "\n";
22+
echo "- getReply() returns a stdClass object: ", $event->getReply() instanceof stdClass ? 'yes' : 'no', "\n";
23+
echo "- getDurationMicros() returns an integer: ", is_integer( $event->getDurationMicros() ) ? 'yes' : 'no', "\n";
24+
echo "- getDurationMicros() returns > 0: ", $event->getDurationMicros() > 0 ? 'yes' : 'no', "\n";
25+
echo "- getCommandName() returns a string: ", is_string( $event->getCommandName() ) ? 'yes' : 'no', "\n";
26+
echo "- getCommandName() returns '", $event->getCommandName(), "'\n";
27+
echo "- getServer() returns an object: ", is_object( $event->getServer() ) ? 'yes' : 'no', "\n";
28+
echo "- getServer() returns a Server object: ", $event->getServer() instanceof MongoDB\Driver\Server ? 'yes' : 'no', "\n";
29+
echo "- getOperationId() returns a string: ", is_string( $event->getOperationId() ) ? 'yes' : 'no', "\n";
30+
echo "- getRequestId() returns a string: ", is_string( $event->getRequestId() ) ? 'yes' : 'no', "\n";
31+
}
3232

33-
public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
34-
{
35-
}
33+
public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
34+
{
35+
}
3636
}
3737

3838
$query = new MongoDB\Driver\Query( [] );

tests/apm/monitoring-commandSucceeded-002.phpt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ $m = new MongoDB\Driver\Manager(STANDALONE);
1010

1111
class MySubscriber implements MongoDB\Driver\Monitoring\CommandSubscriber
1212
{
13-
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
14-
{
15-
echo "started: ", $event->getCommandName(), "\n";
16-
$this->startRequestId = $event->getRequestId();
17-
$this->startOperationId = $event->getOperationId();
18-
}
13+
public function commandStarted( \MongoDB\Driver\Monitoring\CommandStartedEvent $event )
14+
{
15+
echo "started: ", $event->getCommandName(), "\n";
16+
$this->startRequestId = $event->getRequestId();
17+
$this->startOperationId = $event->getOperationId();
18+
}
1919

20-
public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event )
21-
{
22-
echo "succeeded: ", $event->getCommandName(), "\n";
23-
echo "- requestId matches: ", $this->startRequestId == $event->getRequestId() ? 'yes' : 'no', " \n";
24-
echo "- operationId matches: ", $this->startOperationId == $event->getOperationId() ? 'yes' : 'no', " \n";
25-
}
20+
public function commandSucceeded( \MongoDB\Driver\Monitoring\CommandSucceededEvent $event )
21+
{
22+
echo "succeeded: ", $event->getCommandName(), "\n";
23+
echo "- requestId matches: ", $this->startRequestId == $event->getRequestId() ? 'yes' : 'no', " \n";
24+
echo "- operationId matches: ", $this->startOperationId == $event->getOperationId() ? 'yes' : 'no', " \n";
25+
}
2626

27-
public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
28-
{
29-
}
27+
public function commandFailed( \MongoDB\Driver\Monitoring\CommandFailedEvent $event )
28+
{
29+
}
3030
}
3131

3232
$query = new MongoDB\Driver\Query( [] );

0 commit comments

Comments
 (0)