Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4135997
DifferentElementsTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
DifferentElementsTest.php
View Options
<?php
use
Eris\Generators
;
use
Eris\TestTrait
;
class
Type
{
const
TYPE_A
=
1
;
const
TYPE_B
=
2
;
const
TYPE_C
=
3
;
private
$type
;
private
function
__construct
(
$type
)
{
$this
->
type
=
$type
;
}
public
static
function
A
()
{
return
new
self
(
self
::
TYPE_A
);
}
public
static
function
B
()
{
return
new
self
(
self
::
TYPE_B
);
}
public
static
function
C
()
{
return
new
self
(
self
::
TYPE_C
);
}
}
class
DifferentElementsTest
extends
\PHPUnit\Framework\TestCase
{
use
TestTrait
;
/**
* @test
*/
public
function
a_type_is_different_than_another_one
()
{
$allTypes
=
[
Type
::
A
(),
Type
::
B
(),
Type
::
C
(),
];
$remove
=
function
(
$array
,
$whatToRemove
)
{
return
array_values
(
array_filter
(
$array
,
function
(
$candidate
)
use
(
$whatToRemove
)
{
return
$candidate
!=
$whatToRemove
;
}
));
};
$this
->
forAll
(
Generators
::
bind
(
call_user_func_array
(
'Eris
\G
enerator
\e
lements'
,
$allTypes
),
function
(
$first
)
use
(
$allTypes
,
$remove
)
{
return
Generators
::
tuple
(
Generators
::
constant
(
$first
),
Generators
::
elements
(
$remove
(
$allTypes
,
$first
))
);
}
))
->
then
(
function
(
$differentElements
)
{
$this
->
assertNotEquals
(
$differentElements
[
0
],
$differentElements
[
1
],
"Several discussion types are equals"
);
});
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Aug 19, 13:29 (3 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
38/f3/5d526c0639c26f7eded1b6100ecf
Default Alt Text
DifferentElementsTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment