forked from overtrue/easy-sms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ErrorlogGatewayTest.php
46 lines (37 loc) · 1.17 KB
/
ErrorlogGatewayTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/*
* This file is part of the overtrue/easy-sms.
* (c) overtrue <[email protected]>
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Overtrue\EasySms\Tests\Gateways;
use Overtrue\EasySms\Gateways\ErrorlogGateway;
use Overtrue\EasySms\Message;
use Overtrue\EasySms\Support\Config;
use Overtrue\EasySms\Tests\TestCase;
class ErrorlogGatewayTest extends TestCase
{
protected $logFile = 'easy-sms-error-log-mock-file.log';
public function tearDown()
{
parent::tearDown();
unlink($this->logFile);
}
public function testSend()
{
$gateway = new ErrorlogGateway([
'file' => $this->logFile,
]);
$message = new Message([
'content' => 'This is a test message.',
'data' => ['foo' => 'bar'],
]);
$gateway->send(18188888888, $message, new Config());
$this->assertTrue(file_exists($this->logFile));
$this->assertContains(
'to: 18188888888 | message: "This is a test message." | template: "" | data: {"foo":"bar"}',
file_get_contents($this->logFile)
);
}
}