-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathProcessTest.php
More file actions
31 lines (25 loc) · 758 Bytes
/
Copy pathProcessTest.php
File metadata and controls
31 lines (25 loc) · 758 Bytes
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
<?php
namespace Simlux\String\Test\Extensions;
use Simlux\String\StringBuffer;
use Simlux\String\Test\TestCase;
class ProcessTest extends TestCase
{
public function testWhenThen()
{
$buffer = new StringBuffer('foo');
$buffer->when(true, function (StringBuffer $buffer) {
$buffer->append('bar');
});
$this->assertSame('foobar', $buffer->toString());
}
public function testWhenThenElse()
{
$buffer = new StringBuffer('foo');
$buffer->when(false, function (StringBuffer $buffer) {
$buffer->append('bar');
}, function (StringBuffer $buffer) {
$buffer->append('bas');
});
$this->assertSame('foobas', $buffer->toString());
}
}