@@ 25-35 (lines=11) @@ | ||
22 | /** |
|
23 | * @throws UnsupportedTypeException |
|
24 | */ |
|
25 | public function testToWire(): void |
|
26 | { |
|
27 | $q = new Question(); |
|
28 | $q->setName('example.com.'); |
|
29 | $q->setType('NS'); |
|
30 | $q->setClass('IN'); |
|
31 | ||
32 | $expectation = chr(7).'example'.chr(3).'com'.chr(0).pack('nn', 2, 1); |
|
33 | ||
34 | $this->assertEquals($expectation, $q->toWire()); |
|
35 | } |
|
36 | ||
37 | public function testSetClassThrowsException(): void |
|
38 | { |
|
@@ 53-62 (lines=10) @@ | ||
50 | $q->setName('abc123.com'); |
|
51 | } |
|
52 | ||
53 | public function testFromWire(): void |
|
54 | { |
|
55 | $wireFormat = chr(7).'example'.chr(3).'com'.chr(0).pack('nn', 2, 1); |
|
56 | ||
57 | $q = Question::fromWire($wireFormat); |
|
58 | ||
59 | $this->assertEquals('example.com.', $q->getName()); |
|
60 | $this->assertEquals('NS', $q->getType()); |
|
61 | $this->assertEquals('IN', $q->getClass()); |
|
62 | } |
|
63 | ||
64 | public function testSetTypeCodeThrowsException(): void |
|
65 | { |