Skip to content

Commit

Permalink
Fix DingTalk(#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
guanguans committed Jun 9, 2022
1 parent eb4a5e0 commit c71c412
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/Messages/DingTalk/MarkdownMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MarkdownMessage extends Message
'title',
'text',
'atMobiles',
'atUserIds',
'atDingtalkIds',
'isAtAll',
];

Expand All @@ -34,7 +34,7 @@ class MarkdownMessage extends Message
*/
protected $allowedTypes = [
'atMobiles' => ['int', 'string', 'array'],
'atUserIds' => ['int', 'string', 'array'],
'atDingtalkIds' => ['int', 'string', 'array'],
'isAtAll' => 'bool',
];

Expand All @@ -44,7 +44,7 @@ public function configureOptionsResolver(OptionsResolver $resolver): OptionsReso
$resolver->setNormalizer('atMobiles', function (Options $options, $value) {
return (array) $value;
});
$resolver->setNormalizer('atUserIds', function (Options $options, $value) {
$resolver->setNormalizer('atDingtalkIds', function (Options $options, $value) {
return (array) $value;
});
});
Expand Down
6 changes: 3 additions & 3 deletions src/Messages/DingTalk/TextMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TextMessage extends Message
protected $defined = [
'content',
'atMobiles',
'atUserIds',
'atDingtalkIds',
'isAtAll',
];

Expand All @@ -33,7 +33,7 @@ class TextMessage extends Message
*/
protected $allowedTypes = [
'atMobiles' => ['int', 'string', 'array'],
'atUserIds' => ['int', 'string', 'array'],
'atDingtalkIds' => ['int', 'string', 'array'],
'isAtAll' => 'bool',
];

Expand All @@ -43,7 +43,7 @@ public function configureOptionsResolver(OptionsResolver $resolver): OptionsReso
$resolver->setNormalizer('atMobiles', function (Options $options, $value) {
return (array) $value;
});
$resolver->setNormalizer('atUserIds', function (Options $options, $value) {
$resolver->setNormalizer('atDingtalkIds', function (Options $options, $value) {
return (array) $value;
});
});
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/DingTalkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testText()
->setMessage((new \Guanguans\Notify\Messages\DingTalk\TextMessage([
'content' => 'This is content(keyword).',
// 'atMobiles' => [13948484984],
// 'atUserIds' => [123456],
// 'atDingtalkIds' => [123456],
// 'isAtAll' => false,
])))
->send();
Expand Down Expand Up @@ -65,7 +65,7 @@ public function testMarkdown()
'title' => 'This is title.',
'text' => '> This is text(keyword).',
// 'atMobiles' => [13948484984],
// 'atUserIds' => [123456],
// 'atDingtalkIds' => [123456],
// 'isAtAll' => false,
])))
->send();
Expand Down
4 changes: 4 additions & 0 deletions tests/Feature/NowPushTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class NowPushTest extends TestCase
public function testNote()
{
$this->expectException(\GuzzleHttp\Exception\ClientException::class);
// $this->expectException(\GuzzleHttp\Exception\ServerException::class);

Factory::nowPush()
->setToken('vpNVue4teSl93ijHBVT6sDT4sHLP7OMTzFCfdQb0QxLYvL')
Expand All @@ -28,6 +29,7 @@ public function testNote()
public function testImage()
{
$this->expectException(\GuzzleHttp\Exception\ClientException::class);
// $this->expectException(\GuzzleHttp\Exception\ServerException::class);

Factory::nowPush()
->setToken('vpNVue4teSl93ijHBVT6sDT4sHLP7OMTzFCfdQb0QxLYvL')
Expand All @@ -38,6 +40,7 @@ public function testImage()
public function testLink()
{
$this->expectException(\GuzzleHttp\Exception\ClientException::class);
// $this->expectException(\GuzzleHttp\Exception\ServerException::class);

Factory::nowPush()
->setToken('vpNVue4teSl93ijHBVT6sDT4sHLP7OMTzFCfdQb0QxLYvL')
Expand All @@ -48,6 +51,7 @@ public function testLink()
public function testGetUser()
{
$this->expectException(\GuzzleHttp\Exception\ClientException::class);
// $this->expectException(\GuzzleHttp\Exception\ServerException::class);

Factory::nowPush()
->setToken('vpNVue4teSl93ijHBVT6sDT4sHLP7OMTzFCfdQb0QxLYvL')
Expand Down

0 comments on commit c71c412

Please sign in to comment.