Commit Graph

35 Commits

Author SHA1 Message Date
Ben Ramsey c005f69d6e chore: update package files 2021-08-06 14:05:57 -05:00
Ben Ramsey b941aa1a9a Prepare test suite for PHP 8 2020-10-29 18:24:14 -05:00
Bilge 7947413a76 Use assertSame instead of assertEquals. 2020-08-23 13:53:19 +01:00
Ben Ramsey 86c37eff4c Change NodeProviderInterface::getNode() to return Hexadecimal 2020-02-29 22:35:45 -06:00
Ben Ramsey 0bd312f944 Improve test coverage 2020-02-26 20:17:49 -06:00
Ben Ramsey fb4f54fb84 Address static analysis issues 2020-02-08 13:14:17 -06:00
Ben Ramsey e5357f2c8a Add missing native type hints to test method 2020-02-03 16:07:38 -06:00
Ben Ramsey 2e420f94c4 Revert "Suppress MissingNativeTypeHint error from slevomat/coding-standard"
This reverts commit e269c16cd4.

This issue is fixed in slevomat/coding-standard 6.1.4. See thread at
https://github.com/slevomat/coding-standard/issues/883
2020-02-03 16:01:43 -06:00
Marco Pivetta a252f29847 Import used functions and constants via use statement to disallow ambiguity for compiler/static-analysis
As documented in https://wiki.php.net/rfc/use_global_elements, the engine (by default) does a local namespace
lookup, then falls back to global namespace when first calling a global function referenced in namespaced code,
unless that function is referenced via fully qualified name (FQN).

By using the FQN, the actual symbol can be looked up at compile-time, both by the PHP engine and by static analysis
tooling, allowing for compiler (in particular) optimizations to replace known hot-path functions with specialized opcodes.

Sadly, no actual benchmark at hand: the improvements can be minimal or massive, depending on where this library is
used (tight loops being most relevant).
2020-02-03 13:15:35 -06:00
Ben Ramsey e269c16cd4 Suppress MissingNativeTypeHint error from slevomat/coding-standard 2020-02-02 18:38:03 -06:00
Ben Ramsey 12896f06db Use internal exceptions
Fixes #254
2020-01-18 12:13:55 -06:00
Ben Ramsey 0d7b8c2b7a Update coding style to include PSR-12, among other options
This also includes heavy use of slevomat/coding-standard to apply
various checks to the code, based on maintainer (me) preference.
2020-01-18 12:13:55 -06:00
Ben Ramsey 81f0f9a9b4 Clean-up tests and use PHPStan max level for tests 2020-01-18 12:13:09 -06:00
Martin Hujer ca2629767d Require phpstan and correct issues found up to level 2
* issues found by phpstan L0
* issues found by phpstan L1
* issues found by phpstan L2 in src/
* issues found by phpstan L2 in tests/
2020-01-18 12:13:08 -06:00
Ben Ramsey 5d7ee63f1c Update dev requirements and test suite for PHP 7+ only 2020-01-18 12:13:07 -06:00
Ben Ramsey b39ec78f6e Check whether sysfs is readable before attempting to read it
Fixes #260
2019-12-17 02:01:14 -06:00
Ben Ramsey 64ba9a2767 Clean up code according to PhpStorm inspections report 2019-11-30 13:14:52 -08:00
Ben Ramsey 555e5c1102 Test usage of PHP_OS constant 2019-11-30 12:18:43 -08:00
Ben Ramsey 657add4b3c Fix mock invocation assertions 2019-11-30 09:10:09 -08:00
Martin Hujer f3e0fed2d7 Drop remnants of HHVM from tests
It was removed from Travis in c479cdd42f
2019-11-30 09:10:09 -08:00
Ben Ramsey 93a19b8133 Fix failing build due to coding standards violation 2018-07-19 17:19:38 -05:00
Ben Ramsey 8d621488c4 Check whether passthru() is disabled
If passthru() is disabled in php.ini, this will force the
SystemNodeProvider to return `false` for the node. Using the default
FallbackNodeProvider, ramsey/uuid will default to the
RandomNodeProvider, in these cases.

Closes #114
2018-07-19 16:53:00 -05:00
Ben Ramsey b8cac9278c Merge branch 'SystemNodeProvider-FreeBSD-support' of https://github.com/kalifg/uuid into kalifg-SystemNodeProvider-FreeBSD-support 2018-07-19 15:08:45 -05:00
Ben Peachey 62628862df Improvements to the SystemNodeProviderTest class (#211)
* Changes location of providers in the SystemNodeProviderTest

  They are now grouped at the bottom of the class.

* Adds logic to SystemNodeProviderTest.

* Changes call to `file_get_contents` SystemNodeProvider so it can be
  mocked.

* Changes SystemNodeProviderTest so native PHP functions are mocked
  instead of the class under test.

* Changes SystemNodeProviderTest so "\n" is used instead of PHP_EOL

  As the (input or output) of the tests is not system dependant it does
  not make sense to use PHP_EOL. All of these instance have been
  replaced for the sake of readability and stating intent more clearly.

* Adds dataprovider to SystemNodeProvider main test for input
  variations.

* Adds OS to SystemNodeProviderTest dataprovider for Linux fail
  scenario.

* Adds test for SystemNodeProvider to ensure invalid values are not
  accepted.

* Changes names of dataproviders in SystemNodeProviderTest for
  consistency.

* Changes SystemNodeProviderTest by grouping dataproviders together.

* Changes method in SystemNodeProviderTest to use the provided mock
  functions.

* Fixes PSR-2 coding conventions in SystemNodeProviderTest.

* Minor change to SystemNodeProviderTest based on review.
2018-02-07 17:28:02 -06:00
kalifg a7492800e2 Add support for determining MAC address on FreeBSD systems 2018-02-07 15:15:49 -06:00
Ben Ramsey f203f13921 Fix broken build on PHP 5.4 2018-01-19 16:00:06 -06:00
Ben Ramsey e67d6bfdc2 Revert to pre-1.x series of mockery/mockery for ramsey/uuid 3.x 2018-01-16 19:45:47 -06:00
Ben Ramsey 89c3c1777e Fix capitalization of the getSysfs() method 2018-01-16 14:14:34 -06:00
Ben Ramsey 901c3e540d Handle cases where glob() returns false
Fixes #203
2018-01-16 14:11:58 -06:00
Gabriel Caruso f65471fb5c Use assertSame 2017-12-10 05:51:10 -02:00
Robbert Müller 8a540b78a1 mock glob function to get assertions work 2017-11-17 16:16:29 +01:00
Robbert Müller 70346f5da3 Fix whitespace 2017-11-17 15:00:23 +01:00
Robbert Müller a9154c4c27 add testcase for getsysfs 2017-11-17 14:52:51 +01:00
Robbert Müller 3572bf8755 adapt testcases to also mock getsysfs, to get the old code path tested 2017-10-18 11:33:26 +02:00
Andreas Möller 7ff6fff06d Fix: Move tests one up 2016-09-15 08:31:27 +02:00