Skip to content

Instantly share code, notes, and snippets.

@mpartel
Last active December 18, 2015 02:49
Show Gist options
  • Save mpartel/5714229 to your computer and use it in GitHub Desktop.
Save mpartel/5714229 to your computer and use it in GitHub Desktop.
<?php
/**
* Asserts that all data in the fields of $from is present in $to,
* except don't care about $exceptFields in $from.
*
* Works with private fields. Ignores static fields. Ignores empty fields.
*
* This is useful as a basic sanity check that data was copied without
* asserting it field-by-field, which is error-prone.
* If a new field appears in the source object, the test breaks and forces
* you to consider it.
*
* @todo Support $from and $to being arrays.
*
* @param object $from
* @param object $to
* @param array $exceptFields
*/
protected function assertDataWasCopied($from, $to, $exceptFields = [])
{
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment