QueryRegressionTest.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * For full copyright and license information, please see the LICENSE.txt
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  11. * @link http://cakephp.org CakePHP(tm) Project
  12. * @since 3.0.0
  13. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  14. */
  15. namespace Cake\Test\TestCase\ORM;
  16. use Cake\ORM\Query;
  17. use Cake\ORM\Table;
  18. use Cake\ORM\TableRegistry;
  19. use Cake\TestSuite\TestCase;
  20. /**
  21. * Contains regression test for the Query builder
  22. *
  23. */
  24. class QueryRegressionTest extends TestCase {
  25. /**
  26. * Fixture to be used
  27. *
  28. * @var array
  29. */
  30. public $fixtures = ['core.user'];
  31. /**
  32. * Tear down
  33. *
  34. * @return void
  35. */
  36. public function tearDown() {
  37. TableRegistry::clear();
  38. }
  39. /**
  40. * Test for https://github.com/cakephp/cakephp/issues/3087
  41. *
  42. * @return void
  43. */
  44. public function testSelectTimestampColumn() {
  45. $table = TableRegistry::get('users');
  46. $user = $table->find()->where(['id' => 1])->first();
  47. $this->assertEquals(new \DateTime('2007-03-17 01:16:23'), $user->created);
  48. $this->assertEquals(new \DateTime('2007-03-17 01:18:31'), $user->updated);
  49. }
  50. }