elliotchance / elliotchance/concise

array equals diff

Open
#350 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
45
Forks
3
PR merge metrics
No merged PRs in 30d

Description

```php
$this->assert([
['attach', ['event3', [1, 'method5']]],
['attach', ['event1', [1, 'method1']]],
['attach', ['event2', [1, 'method2']]],
['attach', ['event3', [1, 'method4']]],
['attach', ['event3', [1, 'method3']]],
])->equals([
['attach', ['event3', [1, 'method5']]],
['attach', ['event1', [1, 'method1']]],
['attach', ['event3', [1, 'method2']]],
['attach', ['event3', [1, 'method4']]],
['attach', ['event3', [1, 'method3']]],
]);
```
produces
```
[
[
"attach",
[
"event3",
[
1,
"method5"
]
]
],
[
"attach",
[
"event1",
[
1,
"method1"
]
]
],
[
"attach",
[
"event2",
[
1,
"method2"
]
]
],
[
"attach",
[
"event3",
[
1,
"method4"
]
]
],
[
"attach",
[
"event3",
[
1,
"method3"
]
]
]
] equals [
[
"attach",
[
"event3",
[
1,
"method5"
]
]
],
[
"attach",
[
"event1",
[
1,
"method1"
]
]
],
[
"attach",
[
"event3",
[
1,
"method2"
]
]
],
[
"attach",
[
"event3",
[
1,
"method4"
]
]
],
[
"attach",
[
"event3",
[
1,
"method3"
]
]
]
]
```
vs phpunit's
```php
$this->assertEquals([
['attach', ['event3', [1, 'method5']]],
['attach', ['event1', [1, 'method1']]],
['attach', ['event2', [1, 'method2']]],
['attach', ['event3', [1, 'method4']]],
['attach', ['event3', [1, 'method3']]],
], [
['attach', ['event3', [1, 'method5']]],
['attach', ['event1', [1, 'method1']]],
['attach', ['event3', [1, 'method2']]],
['attach', ['event3', [1, 'method4']]],
['attach', ['event3', [1, 'method3']]],
]);
```
which produces
```
--- Expected
+++ Actual
@@ @@
1 => Array (
- 0 => 'event2'
+ 0 => 'event3'
1 => Array (...)
)
)
3 => Array (...)
4 => Array (...)
)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.