Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

0.1.0: Comparisons refactor (#1)

Pre-release
Pre-release
Compare
Choose a tag to compare
@nrawe nrawe released this 21 Nov 22:36
· 25 commits to master since this release
Updates a fair amount of handling to allow for some saner code. The big takeaway is that we now have a dynamic comparisons system which allows extensions to configure assertions per their needs. For example--

```php
<?php

use Rawebone\Tapped\{Extension, Comparison, Comparator};

class MyExtension extends Extension
{
     public function comparisons(Comparator $c)
     {
          $c->register(new class implements Comparison {
               compare($a, $b) { return $a instanceof $b; }
               name() { return 'toBeAnInstanceOf'; }
          });
     }
}
```

We can then call `$expect(new A)->toBeAnInstanceOf(A::class)`. In total this change might not seem very remarkable. However, it allows users to easily and cleanly extend the assertion functionality without needing to bloat the core system. Additionally this allows for domain specific comparisons to be exposed with domain specific extensions.