added better error message handling for ->with() handlers. #95

Closed
wants to merge 6 commits into
from

Projects

None yet

4 participants

@cogitatio

This now prints all public properties and getter values of an object parameter,
so you can better compare, what went wrong with thos objects.

Falk Kühnel and others added some commits Oct 11, 2012
@mvriel
mvriel commented Nov 22, 2012

👍 for this; I have lost more than an hour because I didn't know that a failing with would throw, what seems to be, an unrelated message

@davedevelopment davedevelopment commented on the diff Dec 10, 2012
library/Mockery.php
+ /**
+ * Utility function to format objects to printable arrays
+ *
+ * @param array $args
+ * @return string
+ */
+ public static function formatObjects(array $args = null)
+ {
+ $hasObjects = false;
+ $parts = array();
+ $return = 'Objects: (';
+ if ($args && !empty($args)) {
+ foreach($args as $arg) {
+ if (is_object($arg)) {
+ $hasObjects = true;
+ $parts[get_class($arg)] = self::_objectToArray($arg);
@davedevelopment
davedevelopment Dec 10, 2012 collaborator

Will this be ok with multiple arguments of the same class?

@padraic
padraic Jan 11, 2013 owner

My screen may explode but I'll check over the weekend.

@padraic
Owner
padraic commented Jan 11, 2013

@cogitatio Could you rebase this PR to master if possible? I'll review this in the next day or two and hopefully merge it in. Thanks for contributing!

@padraic
Owner
padraic commented Feb 4, 2013

@cogitatio This has now been merged to master. Thanks for the PR!

@padraic padraic closed this Feb 4, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment