-
Notifications
You must be signed in to change notification settings - Fork 442
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
Failure: test_find_by_datetime
#298
Conversation
This seems to be a Travis issue, as my local test environment shows this test as passing. |
Are you testing against all the database types? From the Travis run, it's not clear where the error is occurring... Might be one of those date formatting bugs reported for SQLite or MySQL that's causing the problems. |
Yea, here's my testing env:
|
Same here:
|
Hmm, I wonder if PHP is configured properly with the timezone on Travis...? I bet everyone else in here has set |
@al-the-x Ah! That sounds like what it is! |
Let's get some context for discussion:
// ActiveRecordFindTest.php:452-461
public function test_find_by_datetime()
{
$now = new DateTime();
$arnow = new ActiveRecord\DateTime();
$arnow->setTimestamp($now->getTimestamp());
Author::find(1)->update_attribute('created_at',$now);
$this->assert_not_null(Author::find_by_created_at($now));
$this->assert_not_null(Author::find_by_created_at($arnow));
} Failure is at 459: $this->assert_not_null(Author::find_by_created_at($now)); What's different about how |
I don't have a timezone set in my php.ini, but yes I also think is has to do with the date and time configuration on travis. |
// Model.php:450-457 in public function assign_attribute($name, $value)
// convert php's \DateTime to ours
if ($value instanceof \DateTime)
$value = new DateTime($value->format('Y-m-d H:i:s T'));
// make sure DateTime values know what model they belong to so
// dirty stuff works when calling set methods on the DateTime object
if ($value instanceof DateTime)
$value->attribute_of($this,$name); Note how the date format is hard-coded... Love that. |
@koenpunt Agreed, or |
Wow, trying to run on my local produces a segfault. Not cool. |
Love that BSD. Running on my Ubuntu dev server, I also get no failures... WTF? |
Turned on query logging (by installing
Super not helpful. |
@al-the-x Yea... summa dat PDO prepare statement logging. :/ |
Re notes on 6ec4a44, I commented out the failing test, which reduced the log line count, indicating to me that both assertions were running, even when the first assertion failed. Let's see if Travis chokes on both assertions... |
It doesn't make me happy, but it gets us to green for the moment. Let's open a separate ticket for figuring this out (someday) and call this one done... |
Punting! Just tell Travis to skip this test and see #307 for (someday) resolution.
Per Travis build 35: