Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Bug report submitted.
https://github.com/codewars/codewars.com/issues/2492
Thank you for your help.
Yes, that's strange, as I get the expected error with the same code. This definitely does seem to be an issue. You can report the bug here: https://github.com/Codewars/codewars.com/issues
I have no idea what would cause that.
I really confirm the issue on my side.
If I input the following empty code:
I run tests, I get, as expected, a PHPUnit error message 'Failed asserting that two arrays are equal.' because my code does not pass the tests.
Now I add an empty class below
Hop, re-run tests: Error : Call to undefined function get_generation()
I tried with another kata, same. No idea what is wrong with my setup. I tried another kata, same. See this recording of my browser https://watch.screencastify.com/v/Ud5L3dxTj3UOK8LLlzIv
I copied and pasted the nonsense code that I wrote above, but I changed
return $a;
toreturn [];
, and I got the expected error:Failed asserting that two arrays are equal.
Whatever you're doing, the tests can't find your get_generation function. It's unlikely that this is something that just affects you, as all the code is run server-side. There must be something wrong with your code. You could post it here (marked as a spoiler if it contains code pertaining to this kata).
I am sorry but what you just said does not work for me. I copy-paste your example and it does not work. Same error when running tests: Error : Call to undefined function get_generation()
I have this global get_generation() function next my classes, and yet I get the error. As soon as I remove the classes, the function is found again. Can you verify, so I know if it is just me or a confirmed issue ?
You can use classes. Just have a global function called get_generation() and instantiate your classes in it, and run the code that way.
So it would look like:
Something like that. The actual tests on the kata are all testing whether the
get_generation
function returns the correct result, so if you don't have aget_generation
function to test, it won't work.Oh :( disappointed. I built a solution in PHP but I use classes, a class Cell and a class Grid.
When I use classes and I run tests, output is
Error : Call to undefined function get_generation()
With no classes it runs fine. So... classes are not supported by codewars PHP ?