File tree Expand file tree Collapse file tree 3 files changed +42
-62
lines changed Expand file tree Collapse file tree 3 files changed +42
-62
lines changed Original file line number Diff line number Diff line change @@ -19,15 +19,6 @@ protected function getEnvironmentSetUp($app)
19
19
]);
20
20
}
21
21
22
- /**
23
- * {@inheritdoc}
24
- */
25
- public function setUp ()
26
- {
27
- parent ::setUp ();
28
- $ this ->manager = Sms::app (Sms::KapAdapter ());
29
- }
30
-
31
22
/**
32
23
* @test
33
24
* @expectedException Linkstreet\LaravelSms\Exceptions\AdapterException
@@ -90,8 +81,8 @@ public function sendSms()
90
81
$ stub ->setClient (new \GuzzleHttp \Client (['handler ' => \GuzzleHttp \HandlerStack::create ($ mock )]));
91
82
92
83
$ response = Sms::app ($ stub )
93
- ->to ($ this -> devices )
94
- ->send ($ this -> message );
84
+ ->to (Sms:: DeviceCollection ([Sms:: Device ( ' +910000000001 ' ), Sms:: Device ( ' 00000 ' )]) )
85
+ ->send (Sms:: Message ( ' Hello world ' ) );
95
86
96
87
$ this ->assertEquals (200 , $ response ->getStatusCode ());
97
88
$ this ->assertTrue ((bool ) $ response ->getSuccessCount ());
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Linkstreet \LaravelSms \Tests ;
4
+
5
+ use Sms ;
6
+
7
+ class CoreTest extends TestCase
8
+ {
9
+ /**
10
+ * Test the device model
11
+ */
12
+ public function testDevice ()
13
+ {
14
+ $ device = Sms::Device ('+910000000000 ' );
15
+ $ this ->assertSame ('+910000000001 ' , $ device ->setNumber ('+910000000001 ' )->getNumber ());
16
+ }
17
+
18
+ /**
19
+ * Test the device collection & device
20
+ */
21
+ public function testDeviceCollection ()
22
+ {
23
+ $ number1 = '+910000000001 ' ;
24
+ $ number2 = '+910000000002 ' ;
25
+ $ devices = Sms::DeviceCollection ([Sms::Device ($ number1 ), Sms::Device ($ number2 )]);
26
+
27
+ $ this ->assertSame (2 , $ devices ->count ());
28
+ $ this ->assertSame ($ number1 , $ devices ->get ($ number1 )->getNumber ());
29
+ $ this ->assertSame ($ number2 , $ devices ->get ($ number2 )->getNumber ());
30
+ }
31
+
32
+ /**
33
+ * Test the message model
34
+ */
35
+ public function testMessage ()
36
+ {
37
+ $ message = Sms::Message ('Hello world ' );
38
+ $ this ->assertSame ('Hello world! ' , $ message ->setMessage ('Hello world! ' )->getMessage ());
39
+ }
40
+ }
Original file line number Diff line number Diff line change 2
2
3
3
namespace Linkstreet \LaravelSms \Tests ;
4
4
5
- use Sms ;
6
-
7
5
abstract class TestCase extends \Orchestra \Testbench \TestCase
8
6
{
9
- public $ device ;
10
-
11
- public $ devices ;
12
-
13
- public $ message ;
14
-
15
7
/**
16
8
* {@inheritdoc}
17
9
*/
@@ -29,47 +21,4 @@ protected function getPackageAliases($app)
29
21
'Sms ' => 'Linkstreet\LaravelSms\Facades\Sms '
30
22
];
31
23
}
32
-
33
- /**
34
- * {@inheritdoc}
35
- */
36
- public function setUp ()
37
- {
38
- parent ::setUp ();
39
- $ this ->device = Sms::Device ('+910000000000 ' );
40
- $ this ->testDevice ();
41
- $ this ->devices = Sms::DeviceCollection ([$ this ->device , Sms::Device ('00000 ' )]);
42
- $ this ->testDeviceCollection ();
43
- $ this ->message = Sms::Message ('Hello world ' );
44
- $ this ->testMessage ();
45
- }
46
-
47
- /**
48
- * Test the device model
49
- */
50
- public function testDevice ()
51
- {
52
- $ this ->assertSame ('+910000000001 ' , $ this ->device ->setNumber ('+910000000001 ' )->getNumber ());
53
- }
54
-
55
- /**
56
- * Test the device collection & device
57
- */
58
- public function testDeviceCollection ()
59
- {
60
- $ count = 0 ;
61
- foreach ($ this ->devices as $ device ) {
62
- $ count ++;
63
- }
64
- $ this ->assertSame ($ count , $ this ->devices ->count ());
65
- $ this ->assertSame ($ this ->device , $ this ->devices ->get ('+910000000001 ' ));
66
- }
67
-
68
- /**
69
- * Test the message model
70
- */
71
- public function testMessage ()
72
- {
73
- $ this ->assertSame ('Hello world! ' , $ this ->message ->setMessage ('Hello world! ' )->getMessage ());
74
- }
75
24
}
You can’t perform that action at this time.
0 commit comments