File: 001.phpt

package info (click to toggle)
php-stomp 1.0.5-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 260 kB
  • ctags: 205
  • sloc: ansic: 1,557; xml: 299; php: 108; makefile: 13; sh: 10
file content (42 lines) | stat: -rw-r--r-- 1,106 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
30
31
32
33
34
35
36
37
38
39
40
41
42
--TEST--
Test Stomp::commit() - tests functionnality and parameters
--SKIPIF--
<?php
    if (!extension_loaded("stomp")) print "skip"; 
    if (!stomp_connect()) print "skip";
?>
--FILE--
<?php 
$s = new Stomp();

/* begin a transaction */
var_dump($s->begin('t1'));

// sends a message to the queue and specifies a good transaction
var_dump($s->send('/queue/test-011-commit', 'bar', array('transaction' => 't1')));

// sends a message to the queue and asks for a receipt
$s->send('/queue/test-011-commit', 'bar', array('transaction' => 't2', 'receipt' => 'tptp'));
echo gettype($s->error()) . PHP_EOL;

// commits a valid transaction
var_dump($s->commit('t1'));

// commits non valid transaction (null as a parameter) and asks for a receipt
var_dump($s->commit(null, array('receipt' => 'commit-key')));
var_dump($s->commit(null));

// commits a non valid transaction (a transaction id that does not exist) and asks for a receipt
$s->commit('t2', array('receipt' => 'commit-key'));
echo gettype($s->error());

unset($s);
?>
--EXPECTF--
bool(true)
bool(true)
string
bool(true)
bool(false)
bool(true)
string