alias(static function (int $id, string $key, string $value) use (&$written): bool { $written[] = "$id:$key=$value"; return false; }); Functions\when('get_post_meta')->alias( static fn (int $id, string $key): string => $key === '_et_pb_show_page_creation' ? 'off' : 'on' ); DiviFlags::set(7); // Like Divi's own save (SyncToServerController.php:382-387), incl. the page creation flow flag. self::assertSame( ['7:_et_pb_use_divi_5=on', '7:_et_pb_use_builder=on', '7:_et_pb_show_page_creation=off'], $written ); } public function testThrowsWhenAFlagDoesNotReadBack(): void { Functions\when('update_post_meta')->justReturn(true); Functions\when('get_post_meta')->alias( static fn (int $id, string $key): string => $key === '_et_pb_use_builder' ? 'off' : 'on' ); $this->expectException(RuntimeException::class); $this->expectExceptionMessage('_et_pb_use_builder'); DiviFlags::set(7); } public function testThrowsWhenThePageCreationFlagDoesNotReadBack(): void { Functions\when('update_post_meta')->justReturn(true); Functions\when('get_post_meta')->justReturn('on'); $this->expectException(RuntimeException::class); $this->expectExceptionMessage('_et_pb_show_page_creation'); DiviFlags::set(7); } }