-
Notifications
You must be signed in to change notification settings - Fork 14
Fix order()->first() bug #85
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 order()->first() bug #85
Conversation
…at capitalization for attribute names are retained. So the short form for New York is now NY instead of ny. test/model/Author, Book, and Venue now have those strtoupper() workarounds in getter/setter methods removed as it's done in Model.php
…rcased in Model.php in order to be case insensitive.
…at capitalization for attribute names are retained. So the short form for New York is now NY instead of ny. test/model/Author, Book, and Venue now have those strtoupper() workarounds in getter/setter methods removed as it's done in Model.php
…rcased in Model.php in order to be case insensitive.
# Conflicts: # lib/Model.php
…cord # Conflicts: # test/ActiveRecordTest.php # test/models/Book.php
…Disable it so that regression does not timeout.
…d#35: Authors table now has a column that is camel cased: firstName Added tests that demonstrate case insensitivity when accessing this firstName column
- Correct link to contributing.md
…vity() is enough.
…cord # Conflicts: # composer.json # scripts/TestCommand.php
…')->find_by_name('Tito') is possible.
…RecordFindByTest.php and ActiveRecordFromTest.php respectively - In doing the above, found and removed duplicated tests - Added test for Relation::testFindBySelect()
1) Author::order('author_id DESC')->find_by_name('Tito'); would clobber order
2) Author::limit(2)->find_by_name('Tito'); would clobber limit
…t have side effects on $this->options
The existing code works.
…cord into RelationDynamicFinders
…. This now passes:
$rel = Author::limit(2)->order('author_id DESC');
$this->assertEquals(Author::last(), $rel->first());
$this->assertEquals(Author::first(), $rel->last());
Codecov Report
@@ Coverage Diff @@
## master #85 +/- ##
=========================================
Coverage 96.73% 96.73%
Complexity 964 964
=========================================
Files 33 33
Lines 2358 2358
=========================================
Hits 2281 2281
Misses 77 77
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Naw, I had a look at your code and it was perfectly fine. I just renamed your method. 😄 |
shmax
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm gonna take your word for it on this one. 👍
According to https://edgeguides.rubyonrails.org/active_record_querying.html#first
the answer is 'yes', so there is a bug in the original test case. This is fixed in the latest commit. If you want to refactor from here, be my guest.