Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Method StreamMetadata::build => StreamMetadata::create #49

Merged
merged 1 commit into from
Nov 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/StreamMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function __construct(
$this->customMetadata = $customMetadata;
}

public static function build(): StreamMetadataBuilder
public static function create(): StreamMetadataBuilder
{
return new StreamMetadataBuilder();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ private function cleanUp(): Generator
yield $this->conn->setStreamMetadataAsync(
'$all',
ExpectedVersion::ANY,
StreamMetadata::build()->build(),
StreamMetadata::create()->build(),
DefaultData::adminCredentials()
);

Expand All @@ -52,7 +52,7 @@ protected function when(): Generator
yield $this->conn->setStreamMetadataAsync(
'$all',
ExpectedVersion::ANY,
StreamMetadata::build()->setReadRoles(SystemRoles::ALL)->build(),
StreamMetadata::create()->setReadRoles(SystemRoles::ALL)->build(),
DefaultData::adminCredentials()
);

Expand Down
2 changes: 1 addition & 1 deletion tests/read_stream_events_with_unresolved_linkto.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected function when(): Generator
yield $this->conn->setStreamMetadataAsync(
'$all',
ExpectedVersion::ANY,
StreamMetadata::build()->setReadRoles(SystemRoles::ALL)->build(),
StreamMetadata::create()->setReadRoles(SystemRoles::ALL)->build(),
DefaultData::adminCredentials()
);

Expand Down
6 changes: 3 additions & 3 deletions tests/soft_delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ public function soft_deleted_stream_when_recreated_preserves_metadata_except_tru
$result = yield $this->conn->setStreamMetadataAsync(
$stream,
ExpectedVersion::NO_STREAM,
StreamMetadata::build()
StreamMetadata::create()
->setTruncateBefore(\PHP_INT_MAX)
->setMaxCount(100)
->setDeleteRoles('some-role')
Expand Down Expand Up @@ -599,7 +599,7 @@ public function setting_json_metadata_on_empty_soft_deleted_stream_recreates_str
$result = yield $this->conn->setStreamMetadataAsync(
$stream,
0,
StreamMetadata::build()
StreamMetadata::create()
->setTruncateBefore(\PHP_INT_MAX)
->setMaxCount(100)
->setDeleteRoles('some-role')
Expand Down Expand Up @@ -662,7 +662,7 @@ public function setting_json_metadata_on_nonempty_soft_deleted_stream_recreates_
$result = yield $this->conn->setStreamMetadataAsync(
$stream,
0,
StreamMetadata::build()
StreamMetadata::create()
->setTruncateBefore(\PHP_INT_MAX)
->setMaxCount(100)
->setDeleteRoles('some-role')
Expand Down
4 changes: 2 additions & 2 deletions tests/subscribe_to_all_catching_up_should.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ private function execute(callable $function): void
yield $this->conn->setStreamMetadataAsync(
'$all',
ExpectedVersion::ANY,
StreamMetadata::build()->setReadRoles(SystemRoles::ALL)->build(),
StreamMetadata::create()->setReadRoles(SystemRoles::ALL)->build(),
new UserCredentials(SystemUsers::ADMIN, SystemUsers::DEFAULT_ADMIN_PASSWORD)
);

Expand All @@ -72,7 +72,7 @@ private function execute(callable $function): void
yield $this->conn->setStreamMetadataAsync(
'$all',
ExpectedVersion::ANY,
StreamMetadata::build()->build(),
StreamMetadata::create()->build(),
new UserCredentials(SystemUsers::ADMIN, SystemUsers::DEFAULT_ADMIN_PASSWORD)
);

Expand Down
2 changes: 1 addition & 1 deletion tests/subscribe_to_all_should.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ private function execute(callable $function): void
yield $connection->setStreamMetadataAsync(
'$all',
ExpectedVersion::ANY,
StreamMetadata::build()->setReadRoles(SystemRoles::ALL)->build(),
StreamMetadata::create()->setReadRoles(SystemRoles::ALL)->build(),
new UserCredentials(SystemUsers::ADMIN, SystemUsers::DEFAULT_ADMIN_PASSWORD)
);

Expand Down
10 changes: 5 additions & 5 deletions tests/when_having_max_count_set_for_stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ private function execute(callable $function): void
yield $this->conn->setStreamMetadataAsync(
$this->stream,
ExpectedVersion::ANY,
StreamMetadata::build()->setMaxCount(3)->build(),
StreamMetadata::create()->setMaxCount(3)->build(),
DefaultData::adminCredentials()
);

Expand Down Expand Up @@ -153,7 +153,7 @@ public function after_setting_less_strict_max_count_read_stream_forward_reads_mo
yield $this->conn->setStreamMetadataAsync(
$this->stream,
ExpectedVersion::ANY,
StreamMetadata::build()->setMaxCount(4)->build(),
StreamMetadata::create()->setMaxCount(4)->build(),
DefaultData::adminCredentials()
);

Expand Down Expand Up @@ -207,7 +207,7 @@ public function after_setting_more_strict_max_count_read_stream_forward_reads_le
yield $this->conn->setStreamMetadataAsync(
$this->stream,
ExpectedVersion::ANY,
StreamMetadata::build()->setMaxCount(2)->build(),
StreamMetadata::create()->setMaxCount(2)->build(),
DefaultData::adminCredentials()
);

Expand Down Expand Up @@ -261,7 +261,7 @@ public function after_setting_less_strict_max_count_read_stream_backward_reads_m
yield $this->conn->setStreamMetadataAsync(
$this->stream,
ExpectedVersion::ANY,
StreamMetadata::build()->setMaxCount(4)->build(),
StreamMetadata::create()->setMaxCount(4)->build(),
DefaultData::adminCredentials()
);

Expand Down Expand Up @@ -315,7 +315,7 @@ public function after_setting_more_strict_max_count_read_stream_backward_reads_l
yield $this->conn->setStreamMetadataAsync(
$this->stream,
ExpectedVersion::ANY,
StreamMetadata::build()->setMaxCount(2)->build(),
StreamMetadata::create()->setMaxCount(2)->build(),
DefaultData::adminCredentials()
);

Expand Down
54 changes: 27 additions & 27 deletions tests/when_having_truncatebefore_set_for_stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function read_event_respects_truncatebefore(): void
yield $this->setStreamMetadata(
$stream,
ExpectedVersion::EMPTY_STREAM,
StreamMetadata::build()->setTruncateBefore(2)
StreamMetadata::create()->setTruncateBefore(2)
);

$res = yield $this->readEvent($stream, 1);
Expand All @@ -116,7 +116,7 @@ public function read_stream_forward_respects_truncatebefore(): void
yield $this->setStreamMetadata(
$stream,
ExpectedVersion::EMPTY_STREAM,
StreamMetadata::build()->setTruncateBefore(2)
StreamMetadata::create()->setTruncateBefore(2)
);

$res = yield $this->conn->readStreamEventsForwardAsync($stream, 0, 100, false, DefaultData::adminCredentials());
Expand All @@ -141,7 +141,7 @@ public function read_stream_backward_respects_truncatebefore(): void
yield $this->setStreamMetadata(
$stream,
ExpectedVersion::EMPTY_STREAM,
StreamMetadata::build()->setTruncateBefore(2)
StreamMetadata::create()->setTruncateBefore(2)
);

$res = yield $this->conn->readStreamEventsBackwardAsync($stream, -1, 100, false, DefaultData::adminCredentials());
Expand All @@ -166,7 +166,7 @@ public function after_setting_less_strict_truncatebefore_read_event_reads_more_e
yield $this->setStreamMetadata(
$stream,
ExpectedVersion::EMPTY_STREAM,
StreamMetadata::build()->setTruncateBefore(2)
StreamMetadata::create()->setTruncateBefore(2)
);

$res = yield $this->readEvent($stream, 1);
Expand All @@ -181,7 +181,7 @@ public function after_setting_less_strict_truncatebefore_read_event_reads_more_e
yield $this->setStreamMetadata(
$stream,
0,
StreamMetadata::build()->setTruncateBefore(1)
StreamMetadata::create()->setTruncateBefore(1)
);

$res = yield $this->readEvent($stream, 0);
Expand All @@ -208,7 +208,7 @@ public function after_setting_more_strict_truncatebefore_read_event_reads_less_e
yield $this->setStreamMetadata(
$stream,
ExpectedVersion::EMPTY_STREAM,
StreamMetadata::build()->setTruncateBefore(2)
StreamMetadata::create()->setTruncateBefore(2)
);

$res = yield $this->readEvent($stream, 1);
Expand All @@ -223,7 +223,7 @@ public function after_setting_more_strict_truncatebefore_read_event_reads_less_e
yield $this->setStreamMetadata(
$stream,
0,
StreamMetadata::build()->setTruncateBefore(3)
StreamMetadata::create()->setTruncateBefore(3)
);

$res = yield $this->readEvent($stream, 2);
Expand All @@ -250,7 +250,7 @@ public function less_strict_max_count_doesnt_change_anything_for_event_read(): v
yield $this->setStreamMetadata(
$stream,
ExpectedVersion::EMPTY_STREAM,
StreamMetadata::build()->setTruncateBefore(2)
StreamMetadata::create()->setTruncateBefore(2)
);

$res = yield $this->readEvent($stream, 1);
Expand All @@ -265,7 +265,7 @@ public function less_strict_max_count_doesnt_change_anything_for_event_read(): v
yield $this->setStreamMetadata(
$stream,
0,
StreamMetadata::build()->setTruncateBefore(2)->setMaxCount(4)
StreamMetadata::create()->setTruncateBefore(2)->setMaxCount(4)
);

$res = yield $this->readEvent($stream, 1);
Expand All @@ -292,7 +292,7 @@ public function more_strict_max_count_gives_less_events_for_event_read(): void
yield $this->setStreamMetadata(
$stream,
ExpectedVersion::EMPTY_STREAM,
StreamMetadata::build()->setTruncateBefore(2)
StreamMetadata::create()->setTruncateBefore(2)
);

$res = yield $this->readEvent($stream, 1);
Expand All @@ -307,7 +307,7 @@ public function more_strict_max_count_gives_less_events_for_event_read(): void
yield $this->setStreamMetadata(
$stream,
0,
StreamMetadata::build()->setTruncateBefore(2)->setMaxCount(2)
StreamMetadata::create()->setTruncateBefore(2)->setMaxCount(2)
);

$res = yield $this->readEvent($stream, 2);
Expand All @@ -334,7 +334,7 @@ public function after_setting_less_strict_truncatebefore_read_stream_forward_rea
yield $this->setStreamMetadata(
$stream,
ExpectedVersion::EMPTY_STREAM,
StreamMetadata::build()->setTruncateBefore(2)
StreamMetadata::create()->setTruncateBefore(2)
);

$res = yield $this->conn->readStreamEventsForwardAsync($stream, 0, 100, false, DefaultData::adminCredentials());
Expand All @@ -347,7 +347,7 @@ public function after_setting_less_strict_truncatebefore_read_stream_forward_rea
yield $this->setStreamMetadata(
$stream,
0,
StreamMetadata::build()->setTruncateBefore(1)
StreamMetadata::create()->setTruncateBefore(1)
);

$res = yield $this->conn->readStreamEventsForwardAsync($stream, 0, 100, false, DefaultData::adminCredentials());
Expand All @@ -372,7 +372,7 @@ public function after_setting_more_strict_truncatebefore_read_stream_forward_rea
yield $this->setStreamMetadata(
$stream,
ExpectedVersion::EMPTY_STREAM,
StreamMetadata::build()->setTruncateBefore(2)
StreamMetadata::create()->setTruncateBefore(2)
);

$res = yield $this->conn->readStreamEventsForwardAsync($stream, 0, 100, false, DefaultData::adminCredentials());
Expand All @@ -385,7 +385,7 @@ public function after_setting_more_strict_truncatebefore_read_stream_forward_rea
yield $this->setStreamMetadata(
$stream,
0,
StreamMetadata::build()->setTruncateBefore(3)
StreamMetadata::create()->setTruncateBefore(3)
);

$res = yield $this->conn->readStreamEventsForwardAsync($stream, 0, 100, false, DefaultData::adminCredentials());
Expand All @@ -410,7 +410,7 @@ public function less_strict_max_count_doesnt_change_anything_for_stream_forward_
yield $this->setStreamMetadata(
$stream,
ExpectedVersion::EMPTY_STREAM,
StreamMetadata::build()->setTruncateBefore(2)
StreamMetadata::create()->setTruncateBefore(2)
);

$res = yield $this->conn->readStreamEventsForwardAsync($stream, 0, 100, false, DefaultData::adminCredentials());
Expand All @@ -423,7 +423,7 @@ public function less_strict_max_count_doesnt_change_anything_for_stream_forward_
yield $this->setStreamMetadata(
$stream,
0,
StreamMetadata::build()->setTruncateBefore(2)->setMaxCount(4)
StreamMetadata::create()->setTruncateBefore(2)->setMaxCount(4)
);

$res = yield $this->conn->readStreamEventsForwardAsync($stream, 0, 100, false, DefaultData::adminCredentials());
Expand All @@ -448,7 +448,7 @@ public function more_strict_max_count_gives_less_events_for_stream_forward_read(
yield $this->setStreamMetadata(
$stream,
ExpectedVersion::EMPTY_STREAM,
StreamMetadata::build()->setTruncateBefore(2)
StreamMetadata::create()->setTruncateBefore(2)
);

$res = yield $this->conn->readStreamEventsForwardAsync($stream, 0, 100, false, DefaultData::adminCredentials());
Expand All @@ -461,7 +461,7 @@ public function more_strict_max_count_gives_less_events_for_stream_forward_read(
yield $this->setStreamMetadata(
$stream,
0,
StreamMetadata::build()->setTruncateBefore(2)->setMaxCount(2)
StreamMetadata::create()->setTruncateBefore(2)->setMaxCount(2)
);

$res = yield $this->conn->readStreamEventsForwardAsync($stream, 0, 100, false, DefaultData::adminCredentials());
Expand All @@ -486,7 +486,7 @@ public function after_setting_less_strict_truncatebefore_read_stream_backward_re
yield $this->setStreamMetadata(
$stream,
ExpectedVersion::EMPTY_STREAM,
StreamMetadata::build()->setTruncateBefore(2)
StreamMetadata::create()->setTruncateBefore(2)
);

$res = yield $this->conn->readStreamEventsBackwardAsync($stream, -1, 100, false, DefaultData::adminCredentials());
Expand All @@ -499,7 +499,7 @@ public function after_setting_less_strict_truncatebefore_read_stream_backward_re
yield $this->setStreamMetadata(
$stream,
0,
StreamMetadata::build()->setTruncateBefore(1)
StreamMetadata::create()->setTruncateBefore(1)
);

$res = yield $this->conn->readStreamEventsBackwardAsync($stream, -1, 100, false, DefaultData::adminCredentials());
Expand All @@ -524,7 +524,7 @@ public function after_setting_more_strict_truncatebefore_read_stream_backward_re
yield $this->setStreamMetadata(
$stream,
ExpectedVersion::EMPTY_STREAM,
StreamMetadata::build()->setTruncateBefore(2)
StreamMetadata::create()->setTruncateBefore(2)
);

$res = yield $this->conn->readStreamEventsBackwardAsync($stream, -1, 100, false, DefaultData::adminCredentials());
Expand All @@ -537,7 +537,7 @@ public function after_setting_more_strict_truncatebefore_read_stream_backward_re
yield $this->setStreamMetadata(
$stream,
0,
StreamMetadata::build()->setTruncateBefore(3)
StreamMetadata::create()->setTruncateBefore(3)
);

$res = yield $this->conn->readStreamEventsBackwardAsync($stream, -1, 100, false, DefaultData::adminCredentials());
Expand All @@ -562,7 +562,7 @@ public function less_strict_max_count_doesnt_change_anything_for_stream_backward
yield $this->setStreamMetadata(
$stream,
ExpectedVersion::EMPTY_STREAM,
StreamMetadata::build()->setTruncateBefore(2)
StreamMetadata::create()->setTruncateBefore(2)
);

$res = yield $this->conn->readStreamEventsBackwardAsync($stream, -1, 100, false, DefaultData::adminCredentials());
Expand All @@ -575,7 +575,7 @@ public function less_strict_max_count_doesnt_change_anything_for_stream_backward
yield $this->setStreamMetadata(
$stream,
0,
StreamMetadata::build()->setTruncateBefore(2)->setMaxCount(4)
StreamMetadata::create()->setTruncateBefore(2)->setMaxCount(4)
);

$res = yield $this->conn->readStreamEventsBackwardAsync($stream, -1, 100, false, DefaultData::adminCredentials());
Expand All @@ -600,7 +600,7 @@ public function more_strict_max_count_gives_less_events_for_stream_backward_read
yield $this->setStreamMetadata(
$stream,
ExpectedVersion::EMPTY_STREAM,
StreamMetadata::build()->setTruncateBefore(2)
StreamMetadata::create()->setTruncateBefore(2)
);

$res = yield $this->conn->readStreamEventsBackwardAsync($stream, -1, 100, false, DefaultData::adminCredentials());
Expand All @@ -613,7 +613,7 @@ public function more_strict_max_count_gives_less_events_for_stream_backward_read
yield $this->setStreamMetadata(
$stream,
0,
StreamMetadata::build()->setTruncateBefore(2)->setMaxCount(2)
StreamMetadata::create()->setTruncateBefore(2)->setMaxCount(2)
);

$res = yield $this->conn->readStreamEventsBackwardAsync($stream, -1, 100, false, DefaultData::adminCredentials());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ public function setting_correctly_formatted_metadata_as_raw_allows_to_read_it_as
public function setting_structured_metadata_with_custom_properties_returns_them_untouched(): void
{
$this->execute(function () {
$metadata = StreamMetadata::build()
$metadata = StreamMetadata::create()
->setMaxCount(17)
->setMaxAge(123321)
->setTruncateBefore(23)
Expand Down Expand Up @@ -439,7 +439,7 @@ public function setting_structured_metadata_with_custom_properties_returns_them_
public function setting_structured_metadata_with_multiple_roles_can_be_read_back(): void
{
$this->execute(function () {
$metadata = StreamMetadata::build()
$metadata = StreamMetadata::create()
->setReadRoles('r1', 'r2', 'r3')
->setWriteRoles('w1', 'w2')
->setDeleteRoles('d1', 'd2', 'd3', 'd4')
Expand Down