Skip to content

Commit 68e945b

Browse files
committed
Use implode to create multiline texts in ObjectDriverTest
So that it's consistent with other tests and OS independent by having always `\n` as EOL.
1 parent 66584f9 commit 68e945b

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

tests/Unit/Drivers/ObjectDriverTest.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ public function it_can_serialize_an_associative_array()
3636
{
3737
$driver = new ObjectDriver();
3838

39-
$expected = <<<'YAML'
40-
foo:
41-
bar: baz
42-
43-
YAML;
39+
$expected = implode("\n", [
40+
'foo:',
41+
' bar: baz',
42+
'',
43+
]);
4444

4545
$this->assertEquals($expected, $driver->serialize(['foo' => ['bar' => 'baz']]));
4646
}
@@ -50,11 +50,11 @@ public function it_can_serialize_an_indexed_array_without_keys()
5050
{
5151
$driver = new ObjectDriver();
5252

53-
$expected = <<<'YAML'
54-
- foo
55-
- bar
56-
57-
YAML;
53+
$expected = implode("\n", [
54+
'- foo',
55+
'- bar',
56+
'',
57+
]);
5858

5959
$this->assertEquals($expected, $driver->serialize(['foo', 'bar']));
6060
}
@@ -64,10 +64,10 @@ public function it_can_serialize_a_simple_object()
6464
{
6565
$driver = new ObjectDriver();
6666

67-
$expected = <<<'YAML'
68-
foo: bar
69-
70-
YAML;
67+
$expected = implode("\n", [
68+
'foo: bar',
69+
'',
70+
]);
7171

7272
$this->assertEquals($expected, $driver->serialize((object) ['foo' => 'bar']));
7373
}
@@ -77,13 +77,13 @@ public function it_can_serialize_a_class_instance()
7777
{
7878
$driver = new ObjectDriver();
7979

80-
$expected = <<<'YAML'
81-
name: 'My name'
82-
valid: true
83-
dateTime: '2020-01-01T15:00:00+01:00'
84-
public: public
85-
86-
YAML;
80+
$expected = implode("\n", [
81+
'name: \'My name\'',
82+
'valid: true',
83+
'dateTime: \'2020-01-01T15:00:00+01:00\'',
84+
'public: public',
85+
'',
86+
]);
8787

8888
$this->assertEquals($expected, $driver->serialize(new Obj()));
8989
}

0 commit comments

Comments
 (0)