Skip to content

Mocking Models #15857

Answered by amcarthur
amcarthur asked this question in Q&A
Discussion options

You must be logged in to vote

Some progress, I added the Files Metadata service to the actual website (i.e. where I bootstrap/register services and stuff) and it dumped out the meta-* php files for models when I navigate to relevant pages. I guess it needed a real database connection to initially generate those, which makes sense.

What I'm still confused about is that my tests worked in Phalcon 2 without mocking modelsManager, modelsMetadata and the database. Only after upgrading to Phalcon 3 did I run into this issue of the models trying to look up metadata in tests. Also, some tests still work in Phalcon 3 without mocking those services, and they too use models. The inconsistency is very confusing.

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by amcarthur
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant