xp-framework / core

The XP Framework is an all-purpose, object oriented PHP framework.
Other
19 stars 6 forks source link

TestSuite cannot handle @expect annotation with empty 'withMessage' attribute #135

Closed kiesel closed 8 years ago

kiesel commented 8 years ago

Given a test like:

  #[@test, @ignore, @expect(class= 'lang.Throwable', withMessage= '')]
  public function expect_some_exception() {
  // ...
  }

This leads to:

$ unittest src/test/php
[............................................................NNNUncaught exception: Exception lang.reflect.TargetInvocationException (xp.unittest.Runner::main)
  at lang.reflect.Method::invoke(NULL, array[1]) [line 350 of class-main.php]
Caused by Exception lang.IndexOutOfBoundsException (Uninitialized string offset: 0)
  at <main>::__error(8, (0x1e)'Uninitialized string offset: 0', (0x70)'/home/idev/dev/xp.private/trunk/xp5/libs/ibus/vendor/xp-framewor', 248, array[6]) [line 248 of TestSuite.class.php]
  at unittest.TestSuite::runInternal(org.oneandone.ibus.command.MessageConsumerCommandTest{}, unittest.TestResult{}) [line 565 of TestSuite.class.php]
  at unittest.TestSuite::run() [line 369 of Runner.class.php]
  at xp.unittest.Runner::run(array[1]) [line 380 of Runner.class.php]
  at xp.unittest.Runner::main(array[1]) [line 0 of StackTraceElement.class.php]
  at ReflectionMethod::invokeArgs(NULL, array[1]) [line 90 of Method.class.php]
thekid commented 8 years ago

This issue belongs to xp-framework/unittest, test are no longer part of core since XP7 (see xp-framework/rfc#293)

thekid commented 8 years ago

:white_check_mark: Fixed in https://github.com/xp-framework/unittest/releases/tag/v7.0.1

kiesel commented 8 years ago

Cool, thanks. But we should backport this, shouldn't we?

thekid commented 8 years ago

But we should backport this, shouldn't we?

OK, you're right: