| @@ 50-65 (lines=16) @@ | ||
| 47 | } |
|
| 48 | ||
| 49 | /** @test */ |
|
| 50 | public function it_replace_both_in_a_string() |
|
| 51 | { |
|
| 52 | $extra = ['hello' => 'world']; |
|
| 53 | ||
| 54 | $notification = [ |
|
| 55 | 'body' => [ |
|
| 56 | 'text' => 'Hi {to.username} hello {extra.hello}', |
|
| 57 | ], |
|
| 58 | 'to' => [ |
|
| 59 | 'username' => 'jhon', |
|
| 60 | ], |
|
| 61 | 'extra' => json_encode($extra), |
|
| 62 | ]; |
|
| 63 | ||
| 64 | $this->parse($notification)->shouldReturn('Hi jhon hello world'); |
|
| 65 | } |
|
| 66 | ||
| 67 | /** @test */ |
|
| 68 | public function it_replace_property_name_of_current_object() |
|
| @@ 86-102 (lines=17) @@ | ||
| 83 | } |
|
| 84 | ||
| 85 | /** @test */ |
|
| 86 | public function it_will_remove_extra_markup_if_extra_value_is_not_provided() |
|
| 87 | { |
|
| 88 | $extra = []; |
|
| 89 | ||
| 90 | $notification = [ |
|
| 91 | 'body' => [ |
|
| 92 | 'text' => 'Hi {to.username} hello {extra.hello}', |
|
| 93 | ], |
|
| 94 | 'to' => [ |
|
| 95 | 'username' => 'jhon', |
|
| 96 | ], |
|
| 97 | 'extra' => json_encode($extra), |
|
| 98 | ]; |
|
| 99 | ||
| 100 | // note the space, TODO: shall i remove it? |
|
| 101 | $this->parse($notification)->shouldReturn('Hi jhon hello '); |
|
| 102 | } |
|
| 103 | ||
| 104 | /** @test */ |
|
| 105 | public function it_will_throw_exception_when_strict_extra_is_enabled() |
|