Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Jan Kuchař
grifart-enum
Commits
828a882f
Commit
828a882f
authored
Jan 09, 2019
by
Jan Kuchař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: does comparing across types works as expected?
parent
ea295f89
Pipeline
#14400
passed with stages
in 36 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
4 deletions
+30
-4
tests/Regression/access-to-non-existing-value-using-static-method-should-throw-an-exception.phpt
...-value-using-static-method-should-throw-an-exception.phpt
+0
-2
tests/Regression/loose-comparison-across-types.phpt
tests/Regression/loose-comparison-across-types.phpt
+30
-0
tests/Regression/mixed-key-type-test.phpt
tests/Regression/mixed-key-type-test.phpt
+0
-2
No files found.
tests/Regression/access-to-non-existing-value-using-static-method-should-throw-an-exception.phpt
View file @
828a882f
<?php
declare
(
strict_types
=
1
);
use
Grifart\Enum\MissingValueDeclarationException
;
require
__DIR__
.
'/../bootstrap.php'
;
/**
...
...
tests/Regression/loose-comparison-across-types.phpt
0 → 100644
View file @
828a882f
<?php
declare
(
strict_types
=
1
);
require
__DIR__
.
'/../bootstrap.php'
;
/**
* @method static Enum1 VALUE()
*/
class
Enum1
extends
\
Grifart\Enum\Enum
{
use
Grifart\Enum\AutoInstances
;
private
const
VALUE
=
'value'
;
}
/**
* @method static Enum2 VALUE()
*/
class
Enum2
extends
\
Grifart\Enum\Enum
{
use
Grifart\Enum\AutoInstances
;
private
const
VALUE
=
'value'
;
}
\
Tester\Assert
::
true
(
Enum1
::
VALUE
()
->
toScalar
()
===
Enum2
::
VALUE
()
->
toScalar
());
// everything same, but type of value is different
\
Tester\Assert
::
false
(
Enum1
::
VALUE
()
===
Enum2
::
VALUE
());
/** @noinspection PhpNonStrictObjectEqualityInspection TypeUnsafeComparisonInspection */
\
Tester\Assert
::
false
(
Enum1
::
VALUE
()
==
Enum2
::
VALUE
());
tests/Regression/mixed-key-type-test.phpt
View file @
828a882f
<?php
declare
(
strict_types
=
1
);
use
Grifart\Enum\MissingValueDeclarationException
;
require
__DIR__
.
'/../bootstrap.php'
;
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment