Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
.. index::
2
    single: Upgrading
3
 
4
Upgrading
5
=========
6
 
7
Upgrading to 1.0.0
8
------------------
9
 
10
Minimum PHP version
11
+++++++++++++++++++
12
 
13
As of Mockery 1.0.0 the minimum PHP version required is 5.6.
14
 
15
Using Mockery with PHPUnit
16
++++++++++++++++++++++++++
17
 
18
In the "old days", 0.9.x and older, the way Mockery was integrated with PHPUnit was
19
through a PHPUnit listener. That listener would in turn call the ``\Mockery::close()``
20
method for us.
21
 
22
As of 1.0.0, PHPUnit test cases where we want to use Mockery, should either use the
23
``\Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration`` trait, or extend the
24
``\Mockery\Adapter\Phpunit\MockeryTestCase`` test case. This will in turn call the
25
``\Mockery::close()`` method for us.
26
 
27
Read the documentation for a detailed overview of ":doc:`/reference/phpunit_integration`".
28
 
29
``\Mockery\Matcher\MustBe`` is deprecated
30
+++++++++++++++++++++++++++++++++++++++++
31
 
32
As of 1.0.0 the ``\Mockery\Matcher\MustBe`` matcher is deprecated and will be removed in
33
Mockery 2.0.0. We recommend instead to use the PHPUnit or Hamcrest equivalents of the
34
MustBe matcher.
35
 
36
``allows`` and ``expects``
37
++++++++++++++++++++++++++
38
 
39
As of 1.0.0, Mockery has two new methods to set up expectations: ``allows`` and ``expects``.
40
This means that these methods names are now "reserved" for Mockery, or in other words
41
classes you want to mock with Mockery, can't have methods called ``allows`` or ``expects``.
42
 
43
Read more in the documentation about this ":doc:`/reference/alternative_should_receive_syntax`".
44
 
45
No more implicit regex matching for string arguments
46
++++++++++++++++++++++++++++++++++++++++++++++++++++
47
 
48
When setting up string arguments in method expectations, Mockery 0.9.x and older, would try
49
to match arguments using a regular expression in a "last attempt" scenario.
50
 
51
As of 1.0.0, Mockery will no longer attempt to do this regex matching, but will only try
52
first the identical operator ``===``, and failing that, the equals operator ``==``.
53
 
54
If you want to match an argument using regular expressions, please use the new
55
``\Mockery\Matcher\Pattern`` matcher. Read more in the documentation about this
56
pattern matcher in the ":doc:`/reference/argument_validation`" section.
57
 
58
``andThrow`` ``\Throwable``
59
+++++++++++++++++++++++++++
60
 
61
As of 1.0.0, the ``andThrow`` can now throw any ``\Throwable``.
62
 
63
Upgrading to 0.9
64
----------------
65
 
66
The generator was completely rewritten, so any code with a deep integration to
67
mockery will need evaluating.
68
 
69
Upgrading to 0.8
70
----------------
71
 
72
Since the release of 0.8.0 the following behaviours were altered:
73
 
74
1. The ``shouldIgnoreMissing()`` behaviour optionally applied to mock objects
75
   returned an instance of ``\Mockery\Undefined`` when methods called did not
76
   match a known expectation. Since 0.8.0, this behaviour was switched to
77
   returning ``null`` instead. You can restore the 0.7.2 behaviour by using the
78
   following:
79
 
80
   .. code-block:: php
81
 
82
       $mock = \Mockery::mock('stdClass')->shouldIgnoreMissing()->asUndefined();