assertEquals(5, count($decoded)); $this->assertArrayHasKey('announce', $decoded); $this->assertEquals('https://tracker.flashii.net/announce.php/meow', $decoded['announce']); $this->assertArrayHasKey('creation date', $decoded); $this->assertEquals(1689973664, $decoded['creation date']); $this->assertArrayHasKey('info', $decoded); $this->assertArrayHasKey('private', $decoded['info']); $this->assertEquals(1, $decoded['info']['private']); $decoded = Bencode::decode(base64_decode(self::TORRENT), associative: false); $this->assertEquals('https://tracker.flashii.net/announce.php/meow', $decoded->announce); $this->assertEquals(1689973664, $decoded->{'creation date'}); $this->assertEquals('this is the comments field', $decoded->comment); $this->assertEquals(1, $decoded->info->private); } public function testEncode(): void { $original = base64_decode(self::TORRENT); $decoded = Bencode::decode($original); $encoded = Bencode::encode($decoded); $this->assertEquals($original, $encoded); } }