-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtopic_partition.phpt
88 lines (79 loc) · 1.49 KB
/
topic_partition.phpt
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
--TEST--
SimpleKafkaClient\TopicPartition
--FILE--
<?php
$topar = new SimpleKafkaClient\TopicPartition("test", RD_KAFKA_PARTITION_UA);
var_dump($topar);
$topar = new SimpleKafkaClient\TopicPartition("test", RD_KAFKA_PARTITION_UA, 42);
var_dump($topar);
$topar = new SimpleKafkaClient\TopicPartition("test", RD_KAFKA_PARTITION_UA, 42, ['test']);
var_dump($topar);
var_dump(array(
"topic" => $topar->getTopicName(),
"partition" => $topar->getPartition(),
"offset" => $topar->getOffset(),
"metadata" => $topar->getMetadata(),
));
$topar
->setTopicName("foo")
->setPartition(123)
->setOffset(43)
->setMetadata(2);
var_dump($topar);
--EXPECT--
object(SimpleKafkaClient\TopicPartition)#1 (4) {
["topic"]=>
string(4) "test"
["partition"]=>
int(-1)
["offset"]=>
int(0)
["metadata"]=>
NULL
}
object(SimpleKafkaClient\TopicPartition)#2 (4) {
["topic"]=>
string(4) "test"
["partition"]=>
int(-1)
["offset"]=>
int(42)
["metadata"]=>
NULL
}
object(SimpleKafkaClient\TopicPartition)#1 (4) {
["topic"]=>
string(4) "test"
["partition"]=>
int(-1)
["offset"]=>
int(42)
["metadata"]=>
array(1) {
[0]=>
string(4) "test"
}
}
array(4) {
["topic"]=>
string(4) "test"
["partition"]=>
int(-1)
["offset"]=>
int(42)
["metadata"]=>
array(1) {
[0]=>
string(4) "test"
}
}
object(SimpleKafkaClient\TopicPartition)#1 (4) {
["topic"]=>
string(3) "foo"
["partition"]=>
int(123)
["offset"]=>
int(43)
["metadata"]=>
int(2)
}