Skip to content

Commit

Permalink
Fixed test with shared data
Browse files Browse the repository at this point in the history
  • Loading branch information
seba-aln committed Nov 5, 2024
1 parent 8ce45c6 commit 3e198e4
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,15 @@ public function testGetAllChannelMetadata()
->sync();

$this->assertNotEmpty($response);
// $this->assertEquals(3, $response->getTotalCount());

$data = $response->getData();

// $this->assertEquals(3, count($data));
// since we share keys between all SDK's we need to filter out other test data and focus only on our own
$data = array_values(array_filter($data, function ($element) {
return in_array($element->getId(), ['ch', 'ch1', 'ch2']);
}));

$this->assertEquals(3, count($data));

$value = $data[0];
$this->assertEquals("ch", $value->getId());
Expand All @@ -84,6 +88,11 @@ public function testGetAllChannelMetadata()
$custom = $value->getCustom();
$this->assertNotEmpty($custom);
$this->assertEquals("aa2", $custom->a);
$this->assertEquals("bb2", $custom->b);
$this->assertEquals("bb2", $custom->b);

// cleanup
$this->pubnub->removeChannelMetadata()->channel("ch")->sync();
$this->pubnub->removeChannelMetadata()->channel("ch1")->sync();
$this->pubnub->removeChannelMetadata()->channel("ch2")->sync();
}
}

0 comments on commit 3e198e4

Please sign in to comment.