Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix query_cache behavior compatibility with Criteria and ModelCriteria #484

Merged
merged 1 commit into from
Nov 22, 2013

Conversation

lunika
Copy link
Contributor

@lunika lunika commented Nov 12, 2013

No description provided.

@staabm
Copy link
Member

staabm commented Nov 12, 2013

what is the issue you are fixing? can you add unit tests for it?

@lunika
Copy link
Contributor Author

lunika commented Nov 12, 2013

There is no open issue, I just found this bugs when I want to use this behavior.

I search for existing unit tests for this behavior but they not exists.

How to test it ? I create a schema like timestampable behavior or I define the schema in the test like I18n ?

@willdurand
Copy link
Contributor

Yeah, I guess it is tricky to test. However, as we might be able to inject our own backend, we might be able to mock a backend to test the behavior. WDYT?

@staabm
Copy link
Member

staabm commented Nov 12, 2013

because the api you changed requires code-generation you could do it like
https://github.com/propelorm/Propel2/blob/master/tests/Propel/Tests/Generator/Behavior/I18n/I18nBehaviorQueryBuilderModifierTest.php

define a schema, build it using QuickBuilder and run your tests...?

I am not familiar with this behavior therefore I could be wrong.. But I am wondering that you need to make those methods public (and therefore creating new API surface). How did it work before (e.g. in Propel1)?

@lunika
Copy link
Contributor Author

lunika commented Nov 12, 2013

I create a first test. I don't think we have to use a custom backend, array backend is enought.

What do you think ? I still like that ? lunika@864cd01

@staabm
Copy link
Member

staabm commented Nov 12, 2013

Thats a good start. But the reason why @willdurand said we need a custom backend is, that you can't verify at the moment, that you query was answered by the cache and not by the DB.

Maybe you could create a mock for such a backend and do the assertion then see
http://phpunit.de/manual/3.0/en/mock-objects.html

@lunika
Copy link
Contributor Author

lunika commented Nov 18, 2013

I add some more tests.

@staabm the query is always answered by the server. The QueryCache behavior only cache the sql code.

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<database name="bookstore-behavior" defaultIdMethod="native" package="behavior.timestampable" namespace="Propel\Tests\Bookstore\Behavior">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can remove the package attribute I guess.

@willdurand
Copy link
Contributor

@lunika please fix the CS stuff first, then rebase your PR and I'll merge it :)

@lunika
Copy link
Contributor Author

lunika commented Nov 22, 2013

I fix cs and remove useless package attribute. When I rebase, git says that I'm already up to date so I guess it's ok ?

@willdurand
Copy link
Contributor

Ah right. I meant "squash" your commits ;-)

with ModelCriteria class

return DataFetcherInterface instance for doCount and doSelect methods in
query_cache behavior
@lunika
Copy link
Contributor Author

lunika commented Nov 22, 2013

I think I have to create a new PR in a new branch and delete this one.

When my commits are squashed I can't push the new one because old commits are already push.

What do you think ?

@marcj
Copy link
Member

marcj commented Nov 22, 2013

You have to force the push. try git push origin +master. That + sign forces the push.

@lunika
Copy link
Contributor Author

lunika commented Nov 22, 2013

Great ! Thank you very much

willdurand added a commit that referenced this pull request Nov 22, 2013
fix query_cache behavior compatibility with Criteria and ModelCriteria
@willdurand willdurand merged commit 47a5903 into propelorm:master Nov 22, 2013
@willdurand
Copy link
Contributor

thanks!

test suite is broken but not your fault.

@lunika
Copy link
Contributor Author

lunika commented Nov 22, 2013

Thanks everybody for your help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants