You are here

public function StreamEncoderTest::testDencode in Replication 8.2

File

tests/src/Unit/Encoder/StreamEncoderTest.php, line 42

Class

StreamEncoderTest
Tests the stream encoder.

Namespace

Drupal\Tests\replication\Unit\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));
}