diff --git a/tests/append_to_stream.php b/tests/append_to_stream.php index 8b5221b0..8034593d 100644 --- a/tests/append_to_stream.php +++ b/tests/append_to_stream.php @@ -247,11 +247,11 @@ public function in_slightly_reasonable_multiple_case_of_multiple_writes_with_exp $x = TestEvent::newTestEvent(); $events = [$x, $x, $x, $x, $x, $x]; - $result = yield $connection->appendToStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, $events); + $result = yield $connection->appendToStreamAsync($stream, ExpectedVersion::NO_STREAM, $events); \assert($result instanceof WriteResult); $this->assertSame(5, $result->nextExpectedVersion()); - $f = yield $connection->appendToStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, $events); + $f = yield $connection->appendToStreamAsync($stream, ExpectedVersion::NO_STREAM, $events); \assert($f instanceof WriteResult); $this->assertSame(5, $f->nextExpectedVersion()); @@ -272,7 +272,7 @@ public function should_fail_writing_with_correct_exp_ver_to_deleted_stream(): vo yield $connection->connectAsync(); - yield $connection->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, true); + yield $connection->deleteStreamAsync($stream, ExpectedVersion::NO_STREAM, true); try { $this->expectException(StreamDeleted::class); @@ -296,7 +296,7 @@ public function should_return_log_position_when_writing(): void yield $connection->connectAsync(); - $result = yield $connection->appendToStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, [TestEvent::newTestEvent()]); + $result = yield $connection->appendToStreamAsync($stream, ExpectedVersion::NO_STREAM, [TestEvent::newTestEvent()]); \assert($result instanceof WriteResult); $this->assertGreaterThan(0, $result->logPosition()->preparePosition()); $this->assertGreaterThan(0, $result->logPosition()->commitPosition()); @@ -319,7 +319,7 @@ public function should_fail_writing_with_any_exp_ver_to_deleted_stream(): void yield $connection->connectAsync(); try { - yield $connection->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, true); + yield $connection->deleteStreamAsync($stream, ExpectedVersion::NO_STREAM, true); } catch (Throwable $e) { $this->fail($e->getMessage()); } @@ -346,7 +346,7 @@ public function should_fail_writing_with_invalid_exp_ver_to_deleted_stream(): vo yield $connection->connectAsync(); - yield $connection->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, true); + yield $connection->deleteStreamAsync($stream, ExpectedVersion::NO_STREAM, true); $this->expectException(StreamDeleted::class); try { @@ -371,7 +371,7 @@ public function should_append_with_correct_exp_ver_to_existing_stream(): void yield $connection->connectAsync(); - yield $connection->appendToStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, [TestEvent::newTestEvent()]); + yield $connection->appendToStreamAsync($stream, ExpectedVersion::NO_STREAM, [TestEvent::newTestEvent()]); $connection->close(); })); @@ -390,7 +390,7 @@ public function should_append_with_any_exp_ver_to_existing_stream(): void yield $connection->connectAsync(); - $result = yield $connection->appendToStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, [TestEvent::newTestEvent()]); + $result = yield $connection->appendToStreamAsync($stream, ExpectedVersion::NO_STREAM, [TestEvent::newTestEvent()]); \assert($result instanceof WriteResult); $this->assertSame(0, $result->nextExpectedVersion()); @@ -437,7 +437,7 @@ public function should_append_with_stream_exists_exp_ver_to_existing_stream(): v yield $connection->connectAsync(); - yield $connection->appendToStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, [TestEvent::newTestEvent()]); + yield $connection->appendToStreamAsync($stream, ExpectedVersion::NO_STREAM, [TestEvent::newTestEvent()]); yield $connection->appendToStreamAsync($stream, ExpectedVersion::STREAM_EXISTS, [TestEvent::newTestEvent()]); $connection->close(); @@ -531,7 +531,7 @@ public function should_fail_appending_with_stream_exists_exp_ver_to_hard_deleted yield $connection->connectAsync(); - yield $connection->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, true); + yield $connection->deleteStreamAsync($stream, ExpectedVersion::NO_STREAM, true); try { $this->expectException(StreamDeleted::class); @@ -555,7 +555,7 @@ public function should_fail_appending_with_stream_exists_exp_ver_to_soft_deleted yield $connection->connectAsync(); - yield $connection->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, false); + yield $connection->deleteStreamAsync($stream, ExpectedVersion::NO_STREAM, false); try { $this->expectException(StreamDeleted::class); @@ -581,7 +581,7 @@ public function can_append_multiple_events_at_once(): void $events = TestEvent::newAmount(100); - $result = yield $connection->appendToStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, $events); + $result = yield $connection->appendToStreamAsync($stream, ExpectedVersion::NO_STREAM, $events); \assert($result instanceof WriteResult); $this->assertSame(99, $result->nextExpectedVersion()); diff --git a/tests/connect.php b/tests/connect.php index ff8aafbd..6cf690ac 100644 --- a/tests/connect.php +++ b/tests/connect.php @@ -133,7 +133,7 @@ public function should_close_connection_after_configured_amount_of_failed_reconn $this->expectException(InvalidOperationException::class); - yield $connection->appendToStreamAsync('stream', ExpectedVersion::EMPTY_STREAM, [TestEvent::newTestEvent()]); + yield $connection->appendToStreamAsync('stream', ExpectedVersion::NO_STREAM, [TestEvent::newTestEvent()]); })); } } diff --git a/tests/deleting_stream.php b/tests/deleting_stream.php index 43eb8e27..2d5c720d 100644 --- a/tests/deleting_stream.php +++ b/tests/deleting_stream.php @@ -40,7 +40,7 @@ public function which_doesnt_exists_should_success_when_passed_empty_stream_expe yield $connection->connectAsync(); - yield $connection->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, true); + yield $connection->deleteStreamAsync($stream, ExpectedVersion::NO_STREAM, true); $connection->close(); })); @@ -101,7 +101,7 @@ public function should_return_log_position_when_writing(): void yield $connection->connectAsync(); - yield $connection->appendToStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, [TestEvent::newTestEvent()]); + yield $connection->appendToStreamAsync($stream, ExpectedVersion::NO_STREAM, [TestEvent::newTestEvent()]); $delete = yield $connection->deleteStreamAsync($stream, 0, true); \assert($delete instanceof DeleteResult); @@ -126,11 +126,11 @@ public function which_was_already_deleted_should_fail(): void yield $connection->connectAsync(); - yield $connection->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, true); + yield $connection->deleteStreamAsync($stream, ExpectedVersion::NO_STREAM, true); try { $this->expectException(StreamDeleted::class); - yield $connection->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, true); + yield $connection->deleteStreamAsync($stream, ExpectedVersion::NO_STREAM, true); } finally { $connection->close(); } diff --git a/tests/read_all_events_backward_should.php b/tests/read_all_events_backward_should.php index c50095ae..d747e5ff 100644 --- a/tests/read_all_events_backward_should.php +++ b/tests/read_all_events_backward_should.php @@ -66,7 +66,7 @@ protected function when(): Generator $this->testEvents = TestEvent::newAmount(20); - yield $this->conn->appendToStreamAsync('stream-' . Guid::generateAsHex(), ExpectedVersion::EMPTY_STREAM, $this->testEvents); + yield $this->conn->appendToStreamAsync('stream-' . Guid::generateAsHex(), ExpectedVersion::NO_STREAM, $this->testEvents); $result = yield $this->conn->appendToStreamAsync('stream-' . Guid::generateAsHex(), ExpectedVersion::NO_STREAM, $this->testEvents); \assert($result instanceof WriteResult); diff --git a/tests/read_all_events_forward_should.php b/tests/read_all_events_forward_should.php index 8146b230..4c41aa92 100644 --- a/tests/read_all_events_forward_should.php +++ b/tests/read_all_events_forward_should.php @@ -70,7 +70,7 @@ protected function when(): Generator $this->testEvents = TestEvent::newAmount(20); $this->stream = 'read_all_events_forward_should-' . Guid::generateAsHex(); - yield $this->conn->appendToStreamAsync($this->stream, ExpectedVersion::EMPTY_STREAM, $this->testEvents); + yield $this->conn->appendToStreamAsync($this->stream, ExpectedVersion::NO_STREAM, $this->testEvents); } protected function end(): Generator diff --git a/tests/read_all_events_forward_with_hard_deleted_stream_should.php b/tests/read_all_events_forward_with_hard_deleted_stream_should.php index 071d923f..8795ff51 100644 --- a/tests/read_all_events_forward_with_hard_deleted_stream_should.php +++ b/tests/read_all_events_forward_with_hard_deleted_stream_should.php @@ -69,7 +69,7 @@ protected function when(): Generator yield $this->conn->appendToStreamAsync( $this->streamName, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, $this->testEvents ); diff --git a/tests/read_event_stream_backward_should.php b/tests/read_event_stream_backward_should.php index 92b9dbba..21f668c4 100644 --- a/tests/read_event_stream_backward_should.php +++ b/tests/read_event_stream_backward_should.php @@ -88,7 +88,7 @@ public function notify_using_status_code_if_stream_was_deleted(): void $store = TestConnection::create(); yield $store->connectAsync(); - yield $store->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, true); + yield $store->deleteStreamAsync($stream, ExpectedVersion::NO_STREAM, true); $read = yield $store->readStreamEventsBackwardAsync( $stream, @@ -141,7 +141,7 @@ public function return_partial_slice_if_no_enough_events_in_stream(): void $testEvents = TestEvent::newAmount(10); yield $store->appendToStreamAsync( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, $testEvents ); @@ -172,7 +172,7 @@ public function return_events_reversed_compared_to_written(): void $testEvents = TestEvent::newAmount(10); yield $store->appendToStreamAsync( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, $testEvents ); @@ -210,7 +210,7 @@ public function be_able_to_read_single_event_from_arbitrary_position(): void $testEvents = TestEvent::newAmount(10); yield $store->appendToStreamAsync( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, $testEvents ); @@ -241,7 +241,7 @@ public function be_able_to_read_first_event(): void $testEvents = TestEvent::newAmount(10); yield $store->appendToStreamAsync( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, $testEvents ); @@ -272,7 +272,7 @@ public function be_able_to_read_last_event(): void $testEvents = TestEvent::newAmount(10); yield $store->appendToStreamAsync( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, $testEvents ); @@ -303,7 +303,7 @@ public function be_able_to_read_slice_from_arbitrary_position(): void $testEvents = TestEvent::newAmount(10); yield $store->appendToStreamAsync( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, $testEvents ); diff --git a/tests/read_event_stream_forward_should.php b/tests/read_event_stream_forward_should.php index 7f78b06d..5c2f51f0 100644 --- a/tests/read_event_stream_forward_should.php +++ b/tests/read_event_stream_forward_should.php @@ -111,7 +111,7 @@ public function notify_using_status_code_if_stream_was_deleted(): void $store = TestConnection::create(); yield $store->connectAsync(); - yield $store->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, true); + yield $store->deleteStreamAsync($stream, ExpectedVersion::NO_STREAM, true); $read = yield $store->readStreamEventsForwardAsync( $stream, @@ -164,7 +164,7 @@ public function return_empty_slice_when_called_on_non_existing_range(): void $testEvents = TestEvent::newAmount(10); yield $store->appendToStreamAsync( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, $testEvents ); @@ -195,7 +195,7 @@ public function return_partial_slice_if_no_enough_events_in_stream(): void $testEvents = TestEvent::newAmount(10); yield $store->appendToStreamAsync( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, $testEvents ); @@ -247,7 +247,7 @@ public function return_events_in_same_order_as_written(): void $testEvents = TestEvent::newAmount(10); yield $store->appendToStreamAsync( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, $testEvents ); @@ -285,7 +285,7 @@ public function be_able_to_read_slice_from_arbitrary_position(): void $testEvents = TestEvent::newAmount(10); yield $store->appendToStreamAsync( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, $testEvents ); diff --git a/tests/read_stream_events_with_unresolved_linkto.php b/tests/read_stream_events_with_unresolved_linkto.php index f2883726..851aeb1e 100644 --- a/tests/read_stream_events_with_unresolved_linkto.php +++ b/tests/read_stream_events_with_unresolved_linkto.php @@ -49,13 +49,13 @@ protected function when(): Generator yield $this->conn->appendToStreamAsync( $this->stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, $this->testEvents ); yield $this->conn->appendToStreamAsync( $this->links, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, [new EventData(null, SystemEventTypes::LINK_TO, false, '0@read_stream_events_with_unresolved_linkto')] ); diff --git a/tests/subscribe_should.php b/tests/subscribe_should.php index 5e6c3da3..7216fdd1 100644 --- a/tests/subscribe_should.php +++ b/tests/subscribe_should.php @@ -56,7 +56,7 @@ public function be_able_to_subscribe_to_non_existing_stream_and_then_catch_new_e $this->eventAppearedResolver($appeared) ); - yield $connection->appendToStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, [TestEvent::newTestEvent()]); + yield $connection->appendToStreamAsync($stream, ExpectedVersion::NO_STREAM, [TestEvent::newTestEvent()]); try { $result = yield timeout($appeared->promise(), self::TIMEOUT); @@ -97,7 +97,7 @@ public function allow_multiple_subscriptions_to_same_stream(): void $this->eventAppearedResolver($appeared2) ); - $connection->appendToStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, [TestEvent::newTestEvent()]); + $connection->appendToStreamAsync($stream, ExpectedVersion::NO_STREAM, [TestEvent::newTestEvent()]); try { $result = yield timeout($appeared1->promise(), self::TIMEOUT); @@ -181,7 +181,7 @@ public function catch_deleted_events_as_well(): void $this->eventAppearedResolver($appeared) ); - yield $connection->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, true); + yield $connection->deleteStreamAsync($stream, ExpectedVersion::NO_STREAM, true); try { $result = yield timeout($appeared->promise(), self::TIMEOUT); diff --git a/tests/subscribe_to_all_should.php b/tests/subscribe_to_all_should.php index 6ce69f34..1b2f40ea 100644 --- a/tests/subscribe_to_all_should.php +++ b/tests/subscribe_to_all_should.php @@ -97,7 +97,7 @@ public function allow_multiple_subscriptions(): void $create = $store->appendToStreamAsync( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, [TestEvent::newTestEvent()] ); @@ -135,7 +135,7 @@ public function catch_deleted_events_as_well(): void $this->droppedWithCountdown($dropped) ); - $delete = $store->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, true); + $delete = $store->deleteStreamAsync($stream, ExpectedVersion::NO_STREAM, true); try { yield Promise\timeout($delete, self::TIMEOUT); diff --git a/tests/subscribe_to_stream_catching_up_should.php b/tests/subscribe_to_stream_catching_up_should.php index bd473f6f..f1c539e5 100644 --- a/tests/subscribe_to_stream_catching_up_should.php +++ b/tests/subscribe_to_stream_catching_up_should.php @@ -131,7 +131,7 @@ public function be_able_to_subscribe_to_non_existing_stream_and_then_catch_event yield $this->conn->appendToStreamAsync( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, [TestEvent::newTestEvent()] ); @@ -183,7 +183,7 @@ public function allow_multiple_subscriptions_to_same_stream(): void yield $this->conn->appendToStreamAsync( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, [TestEvent::newTestEvent()] ); diff --git a/tests/transaction.php b/tests/transaction.php index b60c8959..eaa06ea3 100644 --- a/tests/transaction.php +++ b/tests/transaction.php @@ -276,11 +276,11 @@ public function should_fail_to_commit_if_started_with_correct_ver_but_committing $transaction = yield $this->conn->startTransactionAsync( $stream, - ExpectedVersion::EMPTY_STREAM + ExpectedVersion::NO_STREAM ); \assert($transaction instanceof EventStoreTransaction); - yield $this->conn->appendToStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, [TestEvent::newTestEvent()]); + yield $this->conn->appendToStreamAsync($stream, ExpectedVersion::NO_STREAM, [TestEvent::newTestEvent()]); yield $transaction->writeAsync([TestEvent::newTestEvent()]); @@ -305,7 +305,7 @@ public function should_not_fail_to_commit_if_started_with_wrong_ver_but_committi ); \assert($transaction instanceof EventStoreTransaction); - yield $this->conn->appendToStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, [TestEvent::newTestEvent()]); + yield $this->conn->appendToStreamAsync($stream, ExpectedVersion::NO_STREAM, [TestEvent::newTestEvent()]); yield $transaction->writeAsync([TestEvent::newTestEvent()]); @@ -327,13 +327,13 @@ public function should_fail_to_commit_if_started_with_correct_ver_but_on_commit_ $transaction = yield $this->conn->startTransactionAsync( $stream, - ExpectedVersion::EMPTY_STREAM + ExpectedVersion::NO_STREAM ); \assert($transaction instanceof EventStoreTransaction); yield $transaction->writeAsync([TestEvent::newTestEvent()]); - yield $this->conn->deleteStreamAsync($stream, ExpectedVersion::EMPTY_STREAM, true); + yield $this->conn->deleteStreamAsync($stream, ExpectedVersion::NO_STREAM, true); $this->expectException(StreamDeleted::class); diff --git a/tests/when_having_truncatebefore_set_for_stream.php b/tests/when_having_truncatebefore_set_for_stream.php index ce4a339c..a74fbbbd 100644 --- a/tests/when_having_truncatebefore_set_for_stream.php +++ b/tests/when_having_truncatebefore_set_for_stream.php @@ -45,7 +45,7 @@ private function appendEvents(string $stream): Promise { return $this->conn->appendToStreamAsync( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, $this->testEvents, DefaultData::adminCredentials() ); @@ -88,7 +88,7 @@ public function read_event_respects_truncatebefore(): void yield $this->appendEvents($stream); yield $this->setStreamMetadata( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, StreamMetadata::create()->setTruncateBefore(2) ); @@ -115,7 +115,7 @@ public function read_stream_forward_respects_truncatebefore(): void yield $this->appendEvents($stream); yield $this->setStreamMetadata( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, StreamMetadata::create()->setTruncateBefore(2) ); @@ -140,7 +140,7 @@ public function read_stream_backward_respects_truncatebefore(): void yield $this->appendEvents($stream); yield $this->setStreamMetadata( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, StreamMetadata::create()->setTruncateBefore(2) ); @@ -165,7 +165,7 @@ public function after_setting_less_strict_truncatebefore_read_event_reads_more_e yield $this->appendEvents($stream); yield $this->setStreamMetadata( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, StreamMetadata::create()->setTruncateBefore(2) ); @@ -207,7 +207,7 @@ public function after_setting_more_strict_truncatebefore_read_event_reads_less_e yield $this->appendEvents($stream); yield $this->setStreamMetadata( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, StreamMetadata::create()->setTruncateBefore(2) ); @@ -249,7 +249,7 @@ public function less_strict_max_count_doesnt_change_anything_for_event_read(): v yield $this->appendEvents($stream); yield $this->setStreamMetadata( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, StreamMetadata::create()->setTruncateBefore(2) ); @@ -291,7 +291,7 @@ public function more_strict_max_count_gives_less_events_for_event_read(): void yield $this->appendEvents($stream); yield $this->setStreamMetadata( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, StreamMetadata::create()->setTruncateBefore(2) ); @@ -333,7 +333,7 @@ public function after_setting_less_strict_truncatebefore_read_stream_forward_rea yield $this->appendEvents($stream); yield $this->setStreamMetadata( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, StreamMetadata::create()->setTruncateBefore(2) ); @@ -371,7 +371,7 @@ public function after_setting_more_strict_truncatebefore_read_stream_forward_rea yield $this->appendEvents($stream); yield $this->setStreamMetadata( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, StreamMetadata::create()->setTruncateBefore(2) ); @@ -409,7 +409,7 @@ public function less_strict_max_count_doesnt_change_anything_for_stream_forward_ yield $this->appendEvents($stream); yield $this->setStreamMetadata( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, StreamMetadata::create()->setTruncateBefore(2) ); @@ -447,7 +447,7 @@ public function more_strict_max_count_gives_less_events_for_stream_forward_read( yield $this->appendEvents($stream); yield $this->setStreamMetadata( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, StreamMetadata::create()->setTruncateBefore(2) ); @@ -485,7 +485,7 @@ public function after_setting_less_strict_truncatebefore_read_stream_backward_re yield $this->appendEvents($stream); yield $this->setStreamMetadata( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, StreamMetadata::create()->setTruncateBefore(2) ); @@ -523,7 +523,7 @@ public function after_setting_more_strict_truncatebefore_read_stream_backward_re yield $this->appendEvents($stream); yield $this->setStreamMetadata( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, StreamMetadata::create()->setTruncateBefore(2) ); @@ -561,7 +561,7 @@ public function less_strict_max_count_doesnt_change_anything_for_stream_backward yield $this->appendEvents($stream); yield $this->setStreamMetadata( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, StreamMetadata::create()->setTruncateBefore(2) ); @@ -599,7 +599,7 @@ public function more_strict_max_count_gives_less_events_for_stream_backward_read yield $this->appendEvents($stream); yield $this->setStreamMetadata( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, StreamMetadata::create()->setTruncateBefore(2) ); diff --git a/tests/when_working_with_metadata.php b/tests/when_working_with_metadata.php index 52f6fc2c..1700eb94 100644 --- a/tests/when_working_with_metadata.php +++ b/tests/when_working_with_metadata.php @@ -38,7 +38,7 @@ public function when_getting_metadata_for_an_existing_stream_and_no_metadata_exi yield $connection->appendToStreamAsync( $stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, [TestEvent::newTestEvent()] ); diff --git a/tests/when_working_with_raw_stream_metadata.php b/tests/when_working_with_raw_stream_metadata.php index 9ad6c2e2..cd29d6dc 100644 --- a/tests/when_working_with_raw_stream_metadata.php +++ b/tests/when_working_with_raw_stream_metadata.php @@ -56,7 +56,7 @@ public function setting_empty_metadata_works(): void $this->execute(function () { yield $this->conn->setStreamMetadataAsync( $this->stream, - ExpectedVersion::EMPTY_STREAM + ExpectedVersion::NO_STREAM ); $meta = yield $this->conn->getRawStreamMetadataAsync($this->stream); @@ -77,7 +77,7 @@ public function setting_metadata_few_times_returns_last_metadata(): void $this->execute(function () { yield $this->conn->setStreamMetadataAsync( $this->stream, - ExpectedVersion::EMPTY_STREAM + ExpectedVersion::NO_STREAM ); $meta = yield $this->conn->getRawStreamMetadataAsync($this->stream); @@ -159,7 +159,7 @@ public function setting_metadata_for_not_existing_stream_works(): void $this->execute(function () { yield $this->conn->setStreamMetadataAsync( $this->stream, - ExpectedVersion::EMPTY_STREAM + ExpectedVersion::NO_STREAM ); $meta = yield $this->conn->getRawStreamMetadataAsync($this->stream); @@ -186,7 +186,7 @@ public function setting_metadata_for_existing_stream_works(): void yield $this->conn->setStreamMetadataAsync( $this->stream, - ExpectedVersion::EMPTY_STREAM + ExpectedVersion::NO_STREAM ); $meta = yield $this->conn->getRawStreamMetadataAsync($this->stream); @@ -215,7 +215,7 @@ public function setting_metadata_for_deleted_stream_throws_stream_deleted_except yield $this->conn->setStreamMetadataAsync( $this->stream, - ExpectedVersion::EMPTY_STREAM + ExpectedVersion::NO_STREAM ); }); } @@ -243,7 +243,7 @@ public function getting_metadata_for_nonexisting_stream_returns_empty_string(): public function getting_metadata_for_deleted_stream_returns_empty_string_and_signals_stream_deletion(): void { $this->execute(function () { - yield $this->conn->setStreamMetadataAsync($this->stream, ExpectedVersion::EMPTY_STREAM); + yield $this->conn->setStreamMetadataAsync($this->stream, ExpectedVersion::NO_STREAM); yield $this->conn->deleteStreamAsync($this->stream, ExpectedVersion::NO_STREAM, true); diff --git a/tests/when_working_with_stream_metadata_as_structured_info.php b/tests/when_working_with_stream_metadata_as_structured_info.php index 07e54659..440e6186 100644 --- a/tests/when_working_with_stream_metadata_as_structured_info.php +++ b/tests/when_working_with_stream_metadata_as_structured_info.php @@ -223,7 +223,7 @@ public function setting_metadata_for_existing_stream_works(): void $this->execute(function () { yield $this->conn->appendToStreamAsync( $this->stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, TestEvent::newAmount(2) ); @@ -279,13 +279,13 @@ public function getting_metadata_for_deleted_stream_returns_empty_stream_metadat yield $this->conn->setStreamMetadataAsync( $this->stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, $metadata ); yield $this->conn->deleteStreamAsync( $this->stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, true ); @@ -336,7 +336,7 @@ public function setting_correctly_formatted_metadata_as_raw_allows_to_read_it_as yield $this->conn->setRawStreamMetadataAsync( $this->stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, $metadata ); @@ -398,7 +398,7 @@ public function setting_structured_metadata_with_custom_properties_returns_them_ yield $this->conn->setStreamMetadataAsync( $this->stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, $metadata ); @@ -448,7 +448,7 @@ public function setting_structured_metadata_with_multiple_roles_can_be_read_back yield $this->conn->setStreamMetadataAsync( $this->stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, $metadata ); @@ -487,7 +487,7 @@ public function setting_correct_metadata_with_multiple_roles_in_acl_allows_to_re yield $this->conn->setRawStreamMetadataAsync( $this->stream, - ExpectedVersion::EMPTY_STREAM, + ExpectedVersion::NO_STREAM, $metadata );