Open Jurigag opened 8 years ago
@sjinks could this be somehow solved? I guess it could potentially add big overhead so i think the best options would be something like zephir buildtest
or something like this so any calls to php functions would work with namespace fallback policy? It could make possible to provide better tests coverage for phalcon.
I think PHP does that at compile time…
Not sure if it is possible to implement this in Zephir as namespaced functions are mangled.
Say, test\test_func
becomes test_test_func
.
And it seems like test\test\func
becomes test_test_func
either :-)
I just though that we could somehow intercept function calls in zephir(like xdebug is doing?) and check if in our active namespace we have same function defined and call it instead calling one from the global. I know this will add overhead that's why i was asking from some special option to compile like zephir buildtest
Namespace is a syntactic sugar, there is no notion of namespaces at run time :-(
Oh okay then, too bad, then i guess i can close it :C
@sergeyklay
What is namespace fallback policy:
http://php.net/manual/en/language.namespaces.fallback.php
This is causing that calls to php functions like
is_uploaded_file
and rest of php functions can't be mocked up in tests anyhow because zephir calls php function anyway.Related - https://github.com/phalcon/cphalcon/pull/12352
I know there is probably wrong namespace and it should be
Phalcon\Validation\Validator
but i checked with it and not working anyway.Even creating proxy class and trying diffrent namespaces there don't work :/
Tbh im not sure if there is even anyway to solve it since we have compiled extension, i guess not.