+// GetQRChannel gives a new channel of pairing items to the test.
+func (f *WhatsAppFake) GetQRChannel(ctx context.Context) (<-chan whatsmeow.QRChannelItem, error) {
+ items := make(chan whatsmeow.QRChannelItem, 8)
+ f.pairings <- items
+
+ return items, nil
+}
+
+// PairPhone keeps phone and returns whatsappTestCode.
+func (f *WhatsAppFake) PairPhone(ctx context.Context, phone string, showPushNotification bool, clientType whatsmeow.PairClientType, clientDisplayName string) (string, error) {
+ f.mutex.Lock()
+ defer f.mutex.Unlock()
+
+ f.phones = append(f.phones, phone)
+
+ return whatsappTestCode, nil
+}
+
+// Logout counts the logouts and returns logoutErr.
+func (f *WhatsAppFake) Logout(ctx context.Context) error {
+ f.mutex.Lock()
+ defer f.mutex.Unlock()
+
+ f.logouts++
+
+ return f.logoutErr
+}
+
+// GetJoinedGroups returns groups.
+func (f *WhatsAppFake) GetJoinedGroups(ctx context.Context) ([]*types.GroupInfo, error) {
+ f.mutex.Lock()
+ defer f.mutex.Unlock()
+
+ return f.groups, nil
+}
+
+// GenerateMessageID returns a new message ID.
+func (f *WhatsAppFake) GenerateMessageID() types.MessageID {
+ f.mutex.Lock()
+ defer f.mutex.Unlock()
+
+ return fmt.Sprintf("MSG%d", len(f.sent)+1)
+}
+
+// SendMessage keeps the send and returns sendErr.
+func (f *WhatsAppFake) SendMessage(ctx context.Context, to types.JID, message *waE2E.Message, extra ...whatsmeow.SendRequestExtra) (whatsmeow.SendResponse, error) {
+ f.mutex.Lock()
+ defer f.mutex.Unlock()
+
+ f.sent = append(f.sent, WhatsAppFakeSend{
+ to: to.String(),
+ text: message.GetConversation(),
+ id: extra[0].ID,
+ })
+
+ if f.sendErr != nil {
+ return whatsmeow.SendResponse{}, f.sendErr
+ }
+
+ return whatsmeow.SendResponse{
+ Timestamp: whatsappTestSendTime,
+ }, nil
+}
+
+// Sent returns the sends.
+func (f *WhatsAppFake) Sent() []WhatsAppFakeSend {
+ f.mutex.Lock()
+ defer f.mutex.Unlock()
+
+ return slices.Clone(f.sent)
+}
+
+// Phones returns the phone numbers of the pairings.
+func (f *WhatsAppFake) Phones() []string {
+ f.mutex.Lock()
+ defer f.mutex.Unlock()
+
+ return append([]string{}, f.phones...)
+}
+
+// Logouts returns the number of logouts.
+func (f *WhatsAppFake) Logouts() int {
+ f.mutex.Lock()
+ defer f.mutex.Unlock()
+
+ return f.logouts
+}
+