reactphp/react — pull request #272 by RobinvdVleuten (2014-02-13 16:20:17+00:00)
Title: Added answers to binary dumping

Hi there!

I've added a method for dumping the DNS answers to binaries with corresponding tests. I have used the responses from the ParserTest class to make sure that it's fully compatible.

The only fail is the last test:

```
React\Tests\Dns\Protocol\BinaryDumperTest::testResponseWithTwoAnswersToBinary
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-bc 73 81 80 00 01 00 02 00 00 00 00 02 69 6f 0d 77 68 6f 69 73 2d 73 65 72 76 65 72 73 03 6e 65 74 00 00 01 00 01 c0 0c 00 05 00 01 00 00 00 29 00 0e 05 77 68 6f 69 73 03 6e 69 63 02 69 6f 00 c0 32 00 01 00 01 00 00 0d f7 00 04 c1 df 4e 98
+bc 73 81 80 00 01 00 02 00 00 00 00 02 69 6f 0d 77 68 6f 69 73 2d 73 65 72 76 65 72 73 03 6e 65 74 00 00 01 00 01 c0 0c 00 05 00 01 00 00 00 29 00 0e 05 77 68 6f 69 73 03 6e 69 63 02 69 6f 00 c0 0c 00 01 00 01 00 00 0d f7 00 04 c1 df 4e 98

/Users/robinvdvleuten/Projects/react/tests/Dns/Protocol/BinaryDumperTest.php:192
```

As you can see they are both identical except for the end part:
```
c0 32 00 01 00 01 00 00 0d f7 00 04 c1 df 4e 98
c0 0c 00 01 00 01 00 00 0d f7 00 04 c1 df 4e 98
```

My guess is that it has something to do with `$packetIndex = 12`. But I am not that much of a binary expert so hopefully you guys are willing to help me there :)