Fix base64 encoding with streams

Fixes [gh-207].
This should be removed. We decided to not add PHPUnit as a dependency.