Commit Graph

108 Commits

Author SHA1 Message Date
Jessica Mauerhan cd00a9cb77 Add coverage of generate method 2016-03-13 11:09:51 -04:00
Jessica Mauerhan 30d71f250d Tests for RandomLibAdapter
- Requires Mockery for overloading creation of factory
- Tests for the constructor of the adapter.
2016-03-13 11:04:17 -04:00
Ben Ramsey 369efacd98 Fix test failing on PHP 5.4 because of ::class keyword name resolution 2016-02-13 20:45:33 -06:00
Ben Ramsey e4e38b4059 Add random generator for the PECL libsodium extension 2016-02-13 20:29:32 -06:00
Ben Ramsey cdeed9e65a Apply coding standards to tests, as well 2015-12-17 12:09:17 -06:00
frankdejonge 91d0c6da31 Fixes #91: Made Uuid's serializable. 2015-10-25 22:15:32 +01:00
Ben Ramsey 6d712900f4 Modify Travis CI builds to run tests on multiple CPU architectures
The ramsey/uuid library has requirements to run on 32-bit and 64-bit
systems, as well as little-endian and big-endian systems. Travis CI only
provides hardware for testing 64-bit, little-endian CPU architectures,
but they recently announced support for Docker[^1].

After some research, I found it is possible to use [QEMU][] with
[chroot][] jails on Travis CI to emulate other CPU architectures and run
tests through these chroot jails[^2]. Unfortunately, it takes an awful
long time to set up a chroot jail, build PHP within it, and run the
tests. It wasn't reasonable to expect to do this on every single push to
the ramsey/uuid repository. This is where Docker comes in.

I was able to create chroot jails for each architecture and version of
PHP combination I need to test and then turn these into Docker images,
which Travis is able to download and run fairly quickly. The instances
on which Travis CI is running their Docker services do not currently
support phpenv or php-build, so I needed to masquerade as a Python
project and specify all PHP versions and CPU architectures in
environment variables in my `.travis.yml` configuration. I run
`composer install` and report to Coveralls outside of the Docker images,
but all tests are run within the Docker images.

The Docker image I created for PHP 7.0.0RC4 on MIPS architecture
produces segfaults when attempting to build PHP with Phar. PHP builds
okay without Phar, but then it produces segfaults when running any PHP
script on the image, so I'm leaving out 7.0.0RC4 on MIPS for now.

The Docker images for use with ramsey/uuid tests are available here:
<https://hub.docker.com/r/benramsey/ramsey-uuid/>.

[^1]: "Using Docker on Travis
CI," <http://blog.travis-ci.com/2015-08-19-using-docker-on-travis-ci/>
[^2]: "Running Travis CI tests on ARM architecture,"
<https://www.tomaz.me/2013/12/02/running-travis-ci-tests-on-arm.html>

[qemu]: http://wiki.qemu.org/Main_Page
[chroot]: https://en.wikipedia.org/wiki/Chroot
2015-10-07 22:59:11 -05:00
Ben Ramsey c81933b700 Remove 1.1.2 backwards-compatibility tests 2015-10-03 11:00:08 -05:00
Ben Ramsey f5e96b6af7 Restructure tests 2015-10-03 10:59:44 -05:00
Ben Ramsey e99347f70d Merge pull request #77 from aztech-forks/master
Improve GUID support
2015-08-28 09:36:45 -05:00
Aztech 4c35be716a Remove message assertion -- cannot pass in both 32 and 64 bits envs 2015-08-14 23:26:15 +02:00
Aztech 8c699ecfec Fix exception message assertion in tests 2015-08-14 23:10:23 +02:00
Aztech 896cd9c4e2 Use GUID codec in all cases as it is now endianness independant 2015-08-14 22:43:58 +02:00
Aztech 958468d95b Detect host endianness when building codec 2015-08-14 22:24:16 +02:00
Aztech d3535feb50 Use host dependant endianness in GUID string codec 2015-08-14 21:57:59 +02:00
Ben Ramsey a95140c25c Remove PeclUuidFactory in favor of the new PeclUuid*Generator 2015-07-28 11:25:07 -05:00
Aztech 8974c76bf6 Refactor TimeGeneratorInterface
- Remove UuidFactory from signature
- Remove setters on UuidFactory to prevent inconsistencies (a new feature set and factory should be used instead)
- Update tests to reflect those changes
2015-07-27 11:14:20 -05:00
Ben Ramsey 1bdc10a306 Add RandomBytesGenerator for use with PHP 7. 2015-07-22 21:34:15 +00:00
Ben Ramsey 9092d16213 Have UuidInterface extend from JsonSerializable and cover it with a test 2015-07-16 11:36:05 -05:00
Ben Ramsey b3ef99a2e9 Move RandomGeneratorInterface and RandomGeneratorFactory to Generator NS 2015-07-16 09:54:04 -05:00
Ben Ramsey 40636ca922 Fix "Undefined variable: usec" error in test 2015-06-21 19:38:38 -05:00
Ben Ramsey b375d1de2b Separate uuid CLI tool into separate project
Closes #52
2015-06-21 19:37:32 -05:00
Ben Ramsey de02e532b2 Separate Doctrine\UuidTupe into an external library
Closes #51
2015-06-21 18:05:49 -05:00
Ben Ramsey d67c3490a8 Change namespace to "Ramsey"; closes #48 2015-04-25 12:11:37 -05:00
Ben Ramsey 7513255743 Using extension_loaded() to check whether UUID ext is present 2015-03-22 20:44:30 +00:00
Ben Ramsey 6cfb4fc4c4 PECL UUID extension does not yet work in PHP 7 2015-03-21 20:42:32 +00:00
Thibaud Fabre cc23f64d58 Add COMB generator for use with UUID4 2015-02-07 13:14:58 +01:00
Thibaud Fabre ace0db7707 Skip tests that cannot succeed with HHVM 2014-12-29 22:06:06 +01:00
Thibaud Fabre d6205aaf47 Remove hackish extension_loaded mock 2014-12-29 22:00:47 +01:00
Thibaud Fabre 6047058adc Enable extension
Enable extension

Debug for Travis build

Run PECL tests only

WIP
2014-12-29 22:00:45 +01:00
Thibaud Fabre 34cc28cc30 Add more unit tests for Pecl-based factory
Do not try to install UUID ext in HHVM run
2014-12-29 22:00:36 +01:00
Thibaud Fabre 2873c1ad3f Add tests for Pecl factory 2014-12-17 01:42:57 +01:00
Ben Ramsey 958643e7b6 Introduce Provider namespace and move Node and Time classes into it 2014-11-08 16:16:44 -05:00
Ben Ramsey cd2d09c356 Introduce Converter namespace and move Number and Time classes into it 2014-11-08 14:43:09 -05:00
Thibaud Fabre 61ba697853 Fix decode output for v5 (incorrect hash algo name) 2014-11-08 16:28:19 +01:00
Thibaud Fabre 04c64d6f45 Refactor duplicate code 2014-11-08 15:41:53 +01:00
Thibaud Fabre c07988fe31 Refactor codecs to remove duplication 2014-11-08 15:00:58 +01:00
Thibaud Fabre 84123b2060 Remove all env related logic from factory
Defers all environment related decisions to factory initialization
All behavior is customizable through DI, but all deps are initialized to proper default instances
Removes static factory configuration
2014-11-08 12:41:40 +01:00
Thibaud Fabre f97c9e08f9 Rename degraded feature classes with more consistent names 2014-11-06 10:42:02 +01:00
Thibaud Fabre cd3e58b1f5 Refactor fromInteger method to use factory 2014-10-30 16:07:48 +01:00
Thibaud Fabre 053a25f335 Remove 5.3 build & debug info 2014-10-30 15:16:59 +01:00
Thibaud Fabre fead6f3223 Refactor in the spirit of #1 & #34 2014-10-30 15:16:59 +01:00
Thibaud Fabre 723ef345bf Refactor factory functions
Remove $littleEndian parameter
Add fromGuidString/Bytes factory methods for GUIDs
No longer possible to output GUIDs as UUIDs and vice-versa
Pass tests
2014-10-30 15:15:16 +01:00
Thibaud Fabre 13b3bf7ed9 Refactor from/toString methods to codecs 2014-10-30 15:15:16 +01:00
Thibaud Fabre 65916f2928 Set default timezone in PHPUnit bootstrap to pass HHVM tests 2014-10-30 15:13:45 +01:00
Thibaud Fabre b28029fbc7 Add support for MS GUIDs 2014-10-30 15:13:45 +01:00
Ben Ramsey 0e7e2b8043 Merge branch 'add-from-integer' of github.com:terrycorley/uuid into terrycorley-add-from-integer 2014-10-29 22:52:33 -05:00
Ben Ramsey e66eb997a1 Set timezone for tests 2014-10-24 08:55:20 -05:00
Terry Corley 7fa0c32f8b Adding static fromInteger method to create UUIDs from string integer or BigNumber, along with tests. 2014-07-14 18:44:11 -05:00
Ben Ramsey c43be02bd9 Upgraded to PSR-4 autoloading 2014-02-21 18:35:01 -06:00