forked from smsapi/smsapi-php-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSenderTest.php
More file actions
83 lines (58 loc) · 1.62 KB
/
Copy pathSenderTest.php
File metadata and controls
83 lines (58 loc) · 1.62 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
class SenderTest extends SmsapiTestCase
{
/**
* @var \SMSApi\Api\SenderFactory
*/
private $senderFactory;
private $senderTest = "Olek";
protected function setUp()
{
$this->senderFactory = new \SMSApi\Api\SenderFactory($this->proxy, $this->client());
}
private function renderSenderItem( $item ) {
if ( $item ) {
print("Sendername: " . $item->getName()
. " Status: " . $item->getStatus()
. " Default:" . $item->isDefault()
. "\n" );
} else {
print("Item is null\n" );
}
}
public function testAdd()
{
$result = null;
$action = $this->senderFactory->actionAdd($this->senderTest);
$result = $action->execute();
/* @var $item \SMSApi\Api\Response\CountableResponse */
print("\nSenderAdd: " . $result->getCount() . "\n" );
$this->assertNotEquals( 0, $result->getCount() );
}
public function testList()
{
$result = null;
$error = 0;
$action = $this->senderFactory->actionList();
/* @var $result \SMSApi\Api\Response\SendersResponse */
/* @var $item \SMSApi\Api\Response\SenderResponse */
$result = $action->execute();
echo "\nSenderList:\n";
if ( empty( $result ) ) {
$error++;
}
foreach ( $result->getList() as $item ) {
$this->renderSenderItem( $item );
}
$this->assertEquals( 0, $error );
}
public function testDelete()
{
$result = null;
$action = $this->senderFactory->actionDelete($this->senderTest);
$result = $action->execute();
/* @var $result \SMSApi\Api\Response\CountableResponse */
print("\nSenderDelete: " . $result->getCount() );
$this->assertNotEquals( 0, $result->getCount() );
}
}