phpspec / prophecy

Highly opinionated mocking framework for PHP 5.3+
MIT License
8.53k stars 240 forks source link

cryptic error message #116

Closed cordoval closed 10 years ago

cordoval commented 10 years ago

Is there a way to determine where am i getting this error from?

The hint i get from this is P3, but have no idea what that means in prophecy what is the approach to read these error messages?

1) Gush\Tests\Command\CoreConfigureCommandTest::testCommandWithTrackerOnly
Prophecy\Exception\Call\UnexpectedCallException: Method call:
  Double\Symfony\Component\Console\Helper\QuestionHelper\P3->ask(Symfony\Component\Console\Input\ArrayInput:000000002eecd44b0000000122d41df4, Symfony\Component\Console\Output\StreamOutput:000000002eecd4b50000000122d41df4, Symfony\Component\Console\Question\Question:000000002eecd4b90000000122d41df4)
was not expected.
Expected calls are:
  - getName()
  - setHelperSet(*)
  - ask(type(Symfony\Component\Console\Input\InputInterface), type(Symfony\Component\Console\Output\OutputInterface), question(Symfony\Component\Console\Question\ChoiceQuestion:000000002eecd7210000000122d41df4))
  - ask(type(Symfony\Component\Console\Input\InputInterface), type(Symfony\Component\Console\Output\OutputInterface), question(Symfony\Component\Console\Question\Question:000000002eecd73f0000000122d41df4))
  - ask(type(Symfony\Component\Console\Input\InputInterface), type(Symfony\Component\Console\Output\OutputInterface), question(Symfony\Component\Console\Question\Question:000000002eecd6c80000000122d41df4))
  - ask(type(Symfony\Component\Console\Input\InputInterface), type(Symfony\Component\Console\Output\OutputInterface), question(Symfony\Component\Console\Question\Question:000000002eecd7260000000122d41df4))
  - ask(type(Symfony\Component\Console\Input\InputInterface), type(Symfony\Component\Console\Output\OutputInterface), question(Symfony\Component\Console\Question\ConfirmationQuestion:000000002eecd7290000000122d41df4))
  - ask(type(Symfony\Component\Console\Input\InputInterface), type(Symfony\Component\Console\Output\OutputInterface), question(Symfony\Component\Console\Question\Question:000000002eecd7100000000122d41df4))
  - ask(type(Symfony\Component\Console\Input\InputInterface), type(Symfony\Component\Console\Output\OutputInterface), question(Symfony\Component\Console\Question\Question:000000002eecd7180000000122d41df4))

/Users/cordoval/Sites/gush/vendor/phpspec/prophecy/src/Prophecy/Call/CallCenter.php:140
/Users/cordoval/Sites/gush/vendor/phpspec/prophecy/src/Prophecy/Call/CallCenter.php:81
/Users/cordoval/Sites/gush/vendor/phpspec/prophecy/src/Prophecy/Prophecy/ObjectProphecy.php:180
/Users/cordoval/Sites/gush/src/Adapter/DefaultConfigurator.php:116
/Users/cordoval/Sites/gush/src/Command/Core/CoreConfigureCommand.php:263
/Users/cordoval/Sites/gush/src/Command/Core/CoreConfigureCommand.php:166
/Users/cordoval/Sites/gush/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:244
/Users/cordoval/Sites/gush/vendor/symfony/console/Symfony/Component/Console/Tester/CommandTester.php:80
/Users/cordoval/Sites/gush/tests/Command/CoreConfigureCommandTest.php:210

FAILURES!
Tests: 3, Assertions: 4, Errors: 1.

  [Exception]
  Failed on the testLocal task.

build [-t|--tasks="..."] profile
docteurklein commented 10 years ago

the error says that you called the ask method with unexpected arguments:

It expects the ask method to be called from 7 different manners (as listed) but you called it differently. For sure the arguments differ from one of the 7 possibilities. It may come from the fact prophecy expect the same instance of an object, but you don't give it.

Check the object ids (000000002eecd4b90000000122d41df4 f.e) to see if they differ.

cordoval commented 10 years ago

thanks doc for the diagnosis help :+1: we will troubleshoot with what we have