7
7
8
8
namespace Joomla \Application \Tests ;
9
9
10
- use Joomla \Application \AbstractApplication ;
10
+ use Joomla \Application \Tests \ Stubs \ TestAbstractApplicationObject ;
11
11
use Joomla \Event \DispatcherInterface ;
12
12
use Joomla \Registry \Registry ;
13
13
use Joomla \Test \TestHelper ;
@@ -32,7 +32,7 @@ public function testConstructDefaultBehaviour()
32
32
$ startTime = \time ();
33
33
$ startMicrotime = \microtime (true );
34
34
35
- $ object = $ this -> getMockForAbstractClass (AbstractApplication::class );
35
+ $ object = new TestAbstractApplicationObject ( );
36
36
37
37
$ this ->assertInstanceOf (
38
38
Registry::class,
@@ -56,7 +56,7 @@ public function testConstructDefaultBehaviour()
56
56
public function testConstructDependencyInjection ()
57
57
{
58
58
$ mockConfig = $ this ->createMock (Registry::class);
59
- $ object = $ this -> getMockForAbstractClass (AbstractApplication::class, [ $ mockConfig] );
59
+ $ object = new TestAbstractApplicationObject ( $ mockConfig );
60
60
61
61
$ this ->assertSame (
62
62
$ mockConfig ,
@@ -65,33 +65,14 @@ public function testConstructDependencyInjection()
65
65
);
66
66
}
67
67
68
- /**
69
- * @testdox Tests that \close() exits the application with the given code
70
- *
71
- * @covers Joomla\Application\AbstractApplication
72
- */
73
- public function testClose ()
74
- {
75
- $ object = $ this ->getMockBuilder (AbstractApplication::class)
76
- ->onlyMethods (['close ' ])
77
- ->disableOriginalConstructor ()
78
- ->getMockForAbstractClass ();
79
-
80
- $ object ->expects ($ this ->any ())
81
- ->method ('close ' )
82
- ->willReturnArgument (0 );
83
-
84
- $ this ->assertSame (3 , $ object ->close (3 ));
85
- }
86
-
87
68
/**
88
69
* @testdox Tests that the application is executed successfully.
89
70
*
90
71
* @covers Joomla\Application\AbstractApplication
91
72
*/
92
73
public function testExecute ()
93
74
{
94
- $ object = $ this ->getMockForAbstractClass (AbstractApplication ::class);
75
+ $ object = $ this ->createMock (TestAbstractApplicationObject ::class);
95
76
$ object ->expects ($ this ->once ())
96
77
->method ('doExecute ' );
97
78
@@ -110,7 +91,7 @@ public function testExecuteWithEvents()
110
91
$ dispatcher ->expects ($ this ->exactly (2 ))
111
92
->method ('dispatch ' );
112
93
113
- $ object = $ this ->getMockForAbstractClass (AbstractApplication ::class);
94
+ $ object = $ this ->createMock (TestAbstractApplicationObject ::class);
114
95
$ object ->expects ($ this ->once ())
115
96
->method ('doExecute ' );
116
97
@@ -131,7 +112,7 @@ public function testGet()
131
112
->enableProxyingToOriginalMethods ()
132
113
->getMock ();
133
114
134
- $ object = $ this -> getMockForAbstractClass (AbstractApplication::class, [ $ mockConfig] );
115
+ $ object = new TestAbstractApplicationObject ( $ mockConfig );
135
116
136
117
$ this ->assertSame ('bar ' , $ object ->get ('foo ' , 'car ' ), 'Checks a known configuration setting is returned. ' );
137
118
$ this ->assertSame ('car ' , $ object ->get ('goo ' , 'car ' ), 'Checks an unknown configuration setting returns the default. ' );
@@ -144,7 +125,7 @@ public function testGet()
144
125
*/
145
126
public function testGetLogger ()
146
127
{
147
- $ object = $ this -> getMockForAbstractClass (AbstractApplication::class );
128
+ $ object = new TestAbstractApplicationObject ( );
148
129
149
130
$ this ->assertInstanceOf (NullLogger::class, $ object ->getLogger ());
150
131
}
@@ -160,7 +141,7 @@ public function testSet()
160
141
->enableProxyingToOriginalMethods ()
161
142
->getMock ();
162
143
163
- $ object = $ this -> getMockForAbstractClass (AbstractApplication::class, [ $ mockConfig] );
144
+ $ object = new TestAbstractApplicationObject ( $ mockConfig );
164
145
165
146
$ this ->assertNull ($ object ->set ('foo ' , 'car ' ), 'Checks set returns the previous value. ' );
166
147
$ this ->assertEquals ('car ' , $ object ->get ('foo ' ), 'Checks the new value has been set. ' );
@@ -173,7 +154,7 @@ public function testSet()
173
154
*/
174
155
public function testSetConfiguration ()
175
156
{
176
- $ object = $ this -> getMockForAbstractClass (AbstractApplication::class );
157
+ $ object = new TestAbstractApplicationObject ( );
177
158
$ mockConfig = $ this ->createMock (Registry::class);
178
159
179
160
$ this ->assertSame ($ object , $ object ->setConfiguration ($ mockConfig ), 'The setConfiguration method has a fluent interface ' );
@@ -192,7 +173,7 @@ public function testSetConfiguration()
192
173
*/
193
174
public function testSetLogger ()
194
175
{
195
- $ object = $ this -> getMockForAbstractClass (AbstractApplication::class );
176
+ $ object = new TestAbstractApplicationObject ( );
196
177
$ mockLogger = $ this ->createMock (LoggerInterface::class);
197
178
198
179
$ object ->setLogger ($ mockLogger );
0 commit comments