Skip to content

Commit e64ca04

Browse files
committed
set default boolean values
1 parent 529fa93 commit e64ca04

File tree

6 files changed

+77
-7
lines changed

6 files changed

+77
-7
lines changed

src/SmsapiMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function partner($partner)
7676
* @param bool $test
7777
* @return self
7878
*/
79-
public function test($test)
79+
public function test($test = true)
8080
{
8181
ExceptionFactory::assertArgumentType(1, __METHOD__, 'boolean', $test);
8282
$this->data['test'] = $test;

src/SmsapiSmsMessage.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function from($from)
5757
* @param bool $fast
5858
* @return self
5959
*/
60-
public function fast($fast)
60+
public function fast($fast = true)
6161
{
6262
ExceptionFactory::assertArgumentType(1, __METHOD__, 'boolean', $fast);
6363
$this->data['fast'] = $fast;
@@ -69,7 +69,7 @@ public function fast($fast)
6969
* @param bool $flash
7070
* @return self
7171
*/
72-
public function flash($flash)
72+
public function flash($flash = true)
7373
{
7474
ExceptionFactory::assertArgumentType(1, __METHOD__, 'boolean', $flash);
7575
$this->data['flash'] = $flash;
@@ -93,7 +93,7 @@ public function encoding($encoding)
9393
* @param bool $normalize
9494
* @return self
9595
*/
96-
public function normalize($normalize)
96+
public function normalize($normalize = true)
9797
{
9898
ExceptionFactory::assertArgumentType(1, __METHOD__, 'boolean', $normalize);
9999
$this->data['normalize'] = $normalize;
@@ -105,7 +105,7 @@ public function normalize($normalize)
105105
* @param bool $nounicode
106106
* @return self
107107
*/
108-
public function nounicode($nounicode)
108+
public function nounicode($nounicode = true)
109109
{
110110
ExceptionFactory::assertArgumentType(1, __METHOD__, 'boolean', $nounicode);
111111
$this->data['nounicode'] = $nounicode;
@@ -117,7 +117,7 @@ public function nounicode($nounicode)
117117
* @param bool $single
118118
* @return self
119119
*/
120-
public function single($single)
120+
public function single($single = true)
121121
{
122122
ExceptionFactory::assertArgumentType(1, __METHOD__, 'boolean', $single);
123123
$this->data['single'] = $single;

src/SmsapiVmsMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function interval($interval)
8282
* @param bool $skipGsm
8383
* @return self
8484
*/
85-
public function skipGsm($skipGsm)
85+
public function skipGsm($skipGsm = true)
8686
{
8787
ExceptionFactory::assertArgumentType(1, __METHOD__, 'boolean', $skipGsm);
8888
$this->data['skip_gsm'] = $skipGsm;

tests/SmsapiMessageTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,16 @@ public function set_test($test)
243243
$this->assertEquals($test, $this->message->data['test']);
244244
}
245245

246+
/**
247+
* @test
248+
* @covers ::test
249+
*/
250+
public function set_default_test()
251+
{
252+
$this->message->test();
253+
$this->assertEquals(true, $this->message->data['test']);
254+
}
255+
246256
/**
247257
* @test
248258
* @covers ::test

tests/SmsapiSmsMessageTest.php

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,16 @@ public function set_fast($fast)
109109
$this->assertEquals($fast, $this->message->data['fast']);
110110
}
111111

112+
/**
113+
* @test
114+
* @covers ::test
115+
*/
116+
public function set_default_fast()
117+
{
118+
$this->message->fast();
119+
$this->assertEquals(true, $this->message->data['fast']);
120+
}
121+
112122
/**
113123
* @test
114124
* @covers ::fast
@@ -135,6 +145,16 @@ public function set_flash($flash)
135145
$this->assertEquals($flash, $this->message->data['flash']);
136146
}
137147

148+
/**
149+
* @test
150+
* @covers ::flash
151+
*/
152+
public function set_default_flash()
153+
{
154+
$this->message->flash();
155+
$this->assertEquals(true, $this->message->data['flash']);
156+
}
157+
138158
/**
139159
* @test
140160
* @covers ::flash
@@ -184,6 +204,16 @@ public function set_normalize($normalize)
184204
$this->assertEquals($normalize, $this->message->data['normalize']);
185205
}
186206

207+
/**
208+
* @test
209+
* @covers ::normalize
210+
*/
211+
public function set_default_normalize()
212+
{
213+
$this->message->normalize();
214+
$this->assertEquals(true, $this->message->data['normalize']);
215+
}
216+
187217
/**
188218
* @test
189219
* @covers ::normalize
@@ -210,6 +240,16 @@ public function set_nounicode($nounicode)
210240
$this->assertEquals($nounicode, $this->message->data['nounicode']);
211241
}
212242

243+
/**
244+
* @test
245+
* @covers ::nounicode
246+
*/
247+
public function set_default_nounicode()
248+
{
249+
$this->message->nounicode();
250+
$this->assertEquals(true, $this->message->data['nounicode']);
251+
}
252+
213253
/**
214254
* @test
215255
* @covers ::nounicode
@@ -236,6 +276,16 @@ public function set_single($single)
236276
$this->assertEquals($single, $this->message->data['single']);
237277
}
238278

279+
/**
280+
* @test
281+
* @covers ::test
282+
*/
283+
public function set_default_single()
284+
{
285+
$this->message->single();
286+
$this->assertEquals(true, $this->message->data['single']);
287+
}
288+
239289
/**
240290
* @test
241291
* @covers ::single

tests/SmsapiVmsMessageTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,16 @@ public function set_skip_gsm($skipGsm)
168168
$this->assertEquals($skipGsm, $this->message->data['skip_gsm']);
169169
}
170170

171+
/**
172+
* @test
173+
* @covers ::skipGsm
174+
*/
175+
public function set_default_skip_gsm()
176+
{
177+
$this->message->skipGsm();
178+
$this->assertEquals(true, $this->message->data['skip_gsm']);
179+
}
180+
171181
/**
172182
* @test
173183
* @covers ::skipGsm

0 commit comments

Comments
 (0)