Skip to content
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 .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
tools: composer:v1
tools: composer:v2
- name: Composer cache
uses: actions/cache@v4
with:
Expand Down
25 changes: 25 additions & 0 deletions src/Bot/Model/Request/MessageSendRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ class MessageSendRequest implements ModelInterface
*/
private $transportAttachments;

/**
* @var bool $massCommunication
*
* @Type("bool")
* @Accessor(getter="getMassCommunication",setter="setMassCommunication")
* @Serializer\SerializedName("mass_communication")
*/
private $massCommunication;

/**
* @var int $chatId
*
Expand Down Expand Up @@ -170,6 +179,22 @@ public function setTransportAttachments(TransportAttachments $transportAttachmen
$this->transportAttachments = $transportAttachments;
}

/**
* @return bool|null
*/
public function getMassCommunication(): ?bool
{
return $this->massCommunication;
}

/**
* @param bool|null $massCommunication
*/
public function setMassCommunication(?bool $massCommunication): void
{
$this->massCommunication = $massCommunication;
}

/**
* @return string
*/
Expand Down
32 changes: 32 additions & 0 deletions tests/Bot/Tests/Model/MessageSendRequestTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace RetailCrm\Mg\Bot\Tests\Model;

use PHPUnit\Framework\TestCase;
use RetailCrm\Common\Serializer;
use RetailCrm\Mg\Bot\Model\Request\MessageSendRequest;

class MessageSendRequestTest extends TestCase
{
/**
* @dataProvider dataProvider_massCommunication
* @param bool $value
*/
public function testSerialization_MassCommunication(bool $value): void
{
$request = new MessageSendRequest();
$request->setMassCommunication($value);

$result = Serializer::serialize($request, Serializer::S_ARRAY);

self::assertEquals(['mass_communication' => $value], $result);
}

public function dataProvider_massCommunication(): array
{
return [
[true],
[false],
];
}
}