1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
From 077d174cf14ea2951dd49d9a3b8f1e5ae0309b89 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Mon, 19 Aug 2019 17:10:08 +0200
Subject: [PATCH 1/2] don't use is_real which is deprecated in 7.4
---
library/Mockery/Matcher/Type.php | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/library/Mockery/Matcher/Type.php b/library/Mockery/Matcher/Type.php
index dc189ab0..d81ce834 100644
--- a/library/Mockery/Matcher/Type.php
+++ b/library/Mockery/Matcher/Type.php
@@ -30,7 +30,11 @@ class Type extends MatcherAbstract
*/
public function match(&$actual)
{
- $function = 'is_' . strtolower($this->_expected);
+ if ($this->_expected == 'real') {
+ $function = 'is_float';
+ } else {
+ $function = 'is_' . strtolower($this->_expected);
+ }
if (function_exists($function)) {
return $function($actual);
} elseif (is_string($this->_expected)
From b06f129832b21f4ba70dd52cd0221cf8dc623bd1 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Mon, 19 Aug 2019 17:13:17 +0200
Subject: [PATCH 2/2] real => float in test suite
---
tests/Mockery/ExpectationTest.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/Mockery/ExpectationTest.php b/tests/Mockery/ExpectationTest.php
index e718015d..13774bfa 100644
--- a/tests/Mockery/ExpectationTest.php
+++ b/tests/Mockery/ExpectationTest.php
@@ -1276,14 +1276,14 @@ public function testObjectConstraintThrowsExceptionWhenConstraintUnmatched()
public function testRealConstraintMatchesArgument()
{
- $this->mock->shouldReceive('foo')->with(Mockery::type('real'))->once();
+ $this->mock->shouldReceive('foo')->with(Mockery::type('float'))->once();
$this->mock->foo(2.25);
}
public function testRealConstraintNonMatchingCase()
{
$this->mock->shouldReceive('foo')->times(3);
- $this->mock->shouldReceive('foo')->with(1, Mockery::type('real'))->never();
+ $this->mock->shouldReceive('foo')->with(1, Mockery::type('float'))->never();
$this->mock->foo();
$this->mock->foo(1);
$this->mock->foo(1, 2, 3);
@@ -1291,7 +1291,7 @@ public function testRealConstraintNonMatchingCase()
public function testRealConstraintThrowsExceptionWhenConstraintUnmatched()
{
- $this->mock->shouldReceive('foo')->with(Mockery::type('real'));
+ $this->mock->shouldReceive('foo')->with(Mockery::type('float'));
$this->expectException(\Mockery\Exception::class);
$this->mock->foo('f');
Mockery::close();
|