You are here

public function StreamEncoderTest::testDencode in Replication 8

File

tests/src/Kernel/Encoder/StreamEncoderTest.php, line 47

Class

StreamEncoderTest
Tests the stream encoder.

Namespace

Drupal\Tests\replication\Kernel\Encoder

Code

public function testDencode() {
  $a_string = 'foo';
  $a = $this->encoder
    ->decode($a_string, 'stream');
  $b_string = base64_encode('foo');
  $b = $this->encoder
    ->decode($b_string, 'base64_stream');
  $this
    ->assertTrue(is_resource($a));
  $this
    ->assertEquals(stream_get_contents($a), $a_string);
  $this
    ->assertTrue(is_resource($b));
  $this
    ->assertEquals(stream_get_contents($b), base64_decode($b_string));
}