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

Testing: Declaration of Cake\Chronos\Traits\FrozenTimeTrait #9745

Closed
1 of 3 tasks
mirko-pagliai opened this issue Nov 11, 2016 · 3 comments
Closed
1 of 3 tasks

Testing: Declaration of Cake\Chronos\Traits\FrozenTimeTrait #9745

mirko-pagliai opened this issue Nov 11, 2016 · 3 comments
Labels

Comments

@mirko-pagliai
Copy link
Contributor

This is a (multiple allowed):

  • bug

  • enhancement

  • feature-discussion (RFC)

  • CakePHP Version: 3.3.8

What you did

For my tests, I'm just trying to load some fixtures (from cakephp core) and find records from the database, as described in the cookbook.

Full code is here.

Essentially:

class BackupExportAndImportTest extends TestCase
{
    public $fixtures = ['core.articles', 'core.comments'];

    public function setUp()
    {
        parent::setUp();

        $this->Articles = TableRegistry::get('Articles');
        $this->Comments = TableRegistry::get('Comments');
    }

    /**
     * Internal method to get all records from the database
     * @return array
     */
    protected function _allRecords()
    {
        return [
            'Articles' => $this->Articles->find('all')->hydrate(false)->toArray(),
            'Comments' => $this->Comments->find('all')->hydrate(false)->toArray(),
        ];
    }
    
    public function testExample()
    {
        $this->_allRecords();
    }
}

What happened

Calling:

$this->Articles->find('all')->hydrate(false)->toArray()

I have:

Declaration of Cake\Chronos\Traits\FrozenTimeTrait::setTime($hours, $minutes, $seconds = 0) should be compatible with DateTime::setTime($hour, $minute, $second = NULL, $microseconds = NULL)

I can not reproduce in the error locally, I only get on travis.

Stacktrace:

There was 1 error:
1) MysqlBackup\Test\TestCase\Utility\BackupExportAndImportTest::testExportAndImport
Declaration of Cake\Chronos\Traits\FrozenTimeTrait::setTime($hours, $minutes, $seconds = 0) should be compatible with DateTime::setTime($hour, $minute, $second = NULL, $microseconds = NULL)
/home/travis/build/mirko-pagliai/cakephp-mysql-backup/vendor/cakephp/chronos/src/MutableDate.php:24
/home/travis/build/mirko-pagliai/cakephp-mysql-backup/vendor/cakephp/cakephp/src/I18n/Date.php:26
/home/travis/build/mirko-pagliai/cakephp-mysql-backup/vendor/cakephp/cakephp/src/Database/Type/DateTimeType.php:265
/home/travis/build/mirko-pagliai/cakephp-mysql-backup/vendor/cakephp/cakephp/src/Database/Type/DateTimeType.php:94
/home/travis/build/mirko-pagliai/cakephp-mysql-backup/vendor/cakephp/cakephp/src/Database/Type.php:107
/home/travis/build/mirko-pagliai/cakephp-mysql-backup/vendor/cakephp/cakephp/src/Database/Type.php:122
/home/travis/build/mirko-pagliai/cakephp-mysql-backup/vendor/cakephp/cakephp/src/Database/FieldTypeConverter.php:51
/home/travis/build/mirko-pagliai/cakephp-mysql-backup/vendor/cakephp/cakephp/src/Database/Query.php:194
/home/travis/build/mirko-pagliai/cakephp-mysql-backup/vendor/cakephp/cakephp/src/ORM/Query.php:958
/home/travis/build/mirko-pagliai/cakephp-mysql-backup/vendor/cakephp/cakephp/src/Datasource/QueryTrait.php:276
/home/travis/build/mirko-pagliai/cakephp-mysql-backup/vendor/cakephp/cakephp/src/ORM/Query.php:906
/home/travis/build/mirko-pagliai/cakephp-mysql-backup/vendor/cakephp/cakephp/src/Datasource/QueryTrait.php:293
/home/travis/build/mirko-pagliai/cakephp-mysql-backup/tests/TestCase/Utility/BackupExportAndImportTest.php:77
/home/travis/build/mirko-pagliai/cakephp-mysql-backup/tests/TestCase/Utility/BackupExportAndImportTest.php:90
/home/travis/build/mirko-pagliai/cakephp-mysql-backup/tests/TestCase/Utility/BackupExportAndImportTest.php:145

Full log job:
https://travis-ci.org/mirko-pagliai/cakephp-mysql-backup/jobs/175041605

@ADmad
Copy link
Member

ADmad commented Nov 11, 2016

Looks like the signature of DateTime::setTime() has been changed in PHP 7.1

@mirko-pagliai
Copy link
Contributor Author

@ADmad maybe you're right. In fact, the test fails only with PHP 7.1

@ADmad
Copy link
Member

ADmad commented Nov 11, 2016

This issue was moved to cakephp/chronos#106

@ADmad ADmad closed this as completed Nov 11, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants