bbatsche / Verify

BDD Assertions for PHPUnit and Codeception
MIT License
4 stars 0 forks source link

Expectation Modifiers #18

Closed bbatsche closed 8 years ago

bbatsche commented 9 years ago

Some assertions take in additional options that adjust their functionality. Currently, I'm envisioning:

verify('StRiNg')->withoutCase()->equals('string');
verify(1.0)->withIn(0.1)->equals(1.1);
verify([1])->loosely()->equals(['1']);
bbatsche commented 9 years ago

Better ideas:

verify('StRiNg')->withoutCase()->equals('string');
verify('StRiNg')->withCase()->equals('string');

verify(1.0)->withIn(0.25)->equals(1.125);

verify(array(1, 2, 3))->withoutType()->hasSubset(array('2', '3'));

verify(array($obj))->withIdentity()->contains($obj);
verify(array($objA))->withoutIdentity()->contains($objB);

// $canonicalize
verify(array(1, 2, 3))->withAnyOrder()->equals(array(3, 1, 2));
verify(array(1, 2, 3))->withFixedOrder()->equals(array(1, 2, 3));

verify(array(1, array(2), 3))->withinDepth(1)->equals(array(1, array(4), 3));

verify($domDocument)->withAttributes()->equalsXmlStructure($domDocument);
verify($domDocument)->withoutAttributes()->equalsXmlStructure($domDocument);
bbatsche commented 8 years ago

Turns out $maxDepth is completely ignored. Should we skip over withinDepth(), or throw it in for completeness sake?

bbatsche commented 8 years ago

Need to add documentation for features to README.md