File: amqpqueue_get_channel.phpt

package info (click to toggle)
php-amqp 1.7.1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,024 kB
  • ctags: 578
  • sloc: ansic: 4,223; xml: 784; php: 445; pascal: 42; makefile: 1
file content (29 lines) | stat: -rw-r--r-- 603 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--TEST--
AMQPQueue getChannel() test
--SKIPIF--
<?php if (!extension_loaded("amqp")) print "skip"; ?>
--FILE--
<?php
$cnn = new AMQPConnection();
$cnn->connect();

$ch = new AMQPChannel($cnn);
$ch2 = new AMQPChannel($cnn);

$q = new AMQPQueue($ch);

echo $ch === $q->getChannel() ? 'same' : 'not same', PHP_EOL;
echo $ch2 === $q->getChannel() ? 'same' : 'not same', PHP_EOL;

$old_prefetch = $ch->getPrefetchCount();
$new_prefetch = 999;

$q->getChannel()->setPrefetchCount($new_prefetch);

echo $ch->getPrefetchCount() == $new_prefetch ? 'by ref' : 'copy', PHP_EOL;

?>
--EXPECT--
same
not same
by ref