Uploaded image for project: 'PHP Driver: Library'
  1. PHP Driver: Library
  2. PHPLIB-1147

Utilize Int64 constructor and integer casts in test suite

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.16.0
    • Affects Version/s: None
    • Component/s: Tests
    • None

      In several places through PHPLIB's test suite, Int64 objects are constructed via unserialize(). This can be refactored to use Int64::__construct(), which was made available in PHPC-1949.

      Additionally, there two places where Int64 objects are cast to PHP integers using an intermediary string cast. We should be able to remove the string cast thanks to direct integer casting enabled in PHPC-2213. See:

      Note that we cannot remove preparation of Int64 objects entirely, as PHPUnit's default comparator immediately rejects comparisons between PHP integers and Int64 objects. Changing that would require registering a custom Comparator. That is something we might consider in a future ticket (PHPLIB-1148).

            Assignee:
            andreas.braun@mongodb.com Andreas Braun
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: