Skip to content

Commit

Permalink
Change the BlueskyMessage property to protected
Browse files Browse the repository at this point in the history
  • Loading branch information
kawax committed Sep 7, 2024
1 parent 923339f commit c25db59
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
8 changes: 4 additions & 4 deletions src/Notifications/BlueskyMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

class BlueskyMessage implements Arrayable
{
public ?array $facets = null;
public ?array $embed = null;
public ?array $langs = null;
protected ?array $facets = null;
protected ?array $embed = null;
protected ?array $langs = null;

public function __construct(
public string $text = '',
protected string $text = '',
) {
}

Expand Down
32 changes: 16 additions & 16 deletions tests/Feature/Notifications/NotificationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ public function test_message_facets()
->tag('tag', 'tag');

$this->assertIsArray($m->toArray());
$this->assertSame('testtextatlinktag', $m->text);
$this->assertIsArray($m->facets);
$this->assertSame('testtextatlinktag', $m->toArray()['text']);
$this->assertIsArray($m->toArray()['facets']);
}

public function test_message_facet_index()
Expand All @@ -91,23 +91,23 @@ public function test_message_facet_index()
$this->assertSame([
'byteStart' => 4,
'byteEnd' => 13,
], $m->facets[0]['index']);
], $m->toArray()['facets'][0]['index']);
}

public function test_message_facet()
{
$m = BlueskyMessage::create(text: 'test')
->facet([]);

$this->assertIsArray($m->facets);
$this->assertIsArray($m->toArray()['facets']);
}

public function test_message_embed()
{
$m = BlueskyMessage::create(text: 'test')
->embed([]);

$this->assertIsArray($m->embed);
$this->assertIsArray($m->toArray()['embed']);
}

public function test_message_embed_external()
Expand All @@ -117,10 +117,10 @@ public function test_message_embed_external()
$m = BlueskyMessage::create(text: 'test')
->embed($e);

$this->assertIsArray($m->embed);
$this->assertSame('test', $m->embed['external']['title']);
$this->assertSame('http://', $m->embed['external']['uri']);
$this->assertSame(AtProto::External->value, $m->embed['$type']);
$this->assertIsArray($m->toArray()['embed']);
$this->assertSame('test', $m->toArray()['embed']['external']['title']);
$this->assertSame('http://', $m->toArray()['embed']['external']['uri']);
$this->assertSame(AtProto::External->value, $m->toArray()['embed']['$type']);
}

public function test_message_embed_images()
Expand All @@ -132,19 +132,19 @@ public function test_message_embed_images()
$m = BlueskyMessage::create(text: 'test')
->embed($images);

$this->assertIsArray($m->embed);
$this->assertSame('alt', $m->embed['images'][0]['alt']);
$this->assertSame('alt2', $m->embed['images'][1]['alt']);
$this->assertSame(['blob2'], $m->embed['images'][1]['image']);
$this->assertSame(AtProto::Images->value, $m->embed['$type']);
$this->assertIsArray($m->toArray()['embed']);
$this->assertSame('alt', $m->toArray()['embed']['images'][0]['alt']);
$this->assertSame('alt2', $m->toArray()['embed']['images'][1]['alt']);
$this->assertSame(['blob2'], $m->toArray()['embed']['images'][1]['image']);
$this->assertSame(AtProto::Images->value, $m->toArray()['embed']['$type']);
}

public function test_message_langs()
{
$m = BlueskyMessage::create(text: 'test')
->langs(['en']);

$this->assertSame(['en'], $m->langs);
$this->assertSame(['en'], $m->toArray()['langs']);
}

public function test_message_new_line()
Expand All @@ -153,7 +153,7 @@ public function test_message_new_line()
->newLine(2)
->text('test');

$this->assertSame('test'.PHP_EOL.PHP_EOL.'test', $m->text);
$this->assertSame('test'.PHP_EOL.PHP_EOL.'test', $m->toArray()['text']);
}

public function test_route()
Expand Down

0 comments on commit c25db59

Please sign in to comment.