77
88namespace Joomla \Application \Tests ;
99
10- use Joomla \Application \AbstractApplication ;
10+ use Joomla \Application \Tests \ Stubs \ TestAbstractApplicationObject ;
1111use Joomla \Event \DispatcherInterface ;
1212use Joomla \Registry \Registry ;
1313use Joomla \Test \TestHelper ;
@@ -32,7 +32,7 @@ public function testConstructDefaultBehaviour()
3232 $ startTime = \time ();
3333 $ startMicrotime = \microtime (true );
3434
35- $ object = $ this -> getMockForAbstractClass (AbstractApplication::class );
35+ $ object = new TestAbstractApplicationObject ( );
3636
3737 $ this ->assertInstanceOf (
3838 Registry::class,
@@ -56,7 +56,7 @@ public function testConstructDefaultBehaviour()
5656 public function testConstructDependencyInjection ()
5757 {
5858 $ mockConfig = $ this ->createMock (Registry::class);
59- $ object = $ this -> getMockForAbstractClass (AbstractApplication::class, [ $ mockConfig] );
59+ $ object = new TestAbstractApplicationObject ( $ mockConfig );
6060
6161 $ this ->assertSame (
6262 $ mockConfig ,
@@ -65,33 +65,14 @@ public function testConstructDependencyInjection()
6565 );
6666 }
6767
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-
8768 /**
8869 * @testdox Tests that the application is executed successfully.
8970 *
9071 * @covers Joomla\Application\AbstractApplication
9172 */
9273 public function testExecute ()
9374 {
94- $ object = $ this ->getMockForAbstractClass (AbstractApplication ::class);
75+ $ object = $ this ->createMock (TestAbstractApplicationObject ::class);
9576 $ object ->expects ($ this ->once ())
9677 ->method ('doExecute ' );
9778
@@ -110,7 +91,7 @@ public function testExecuteWithEvents()
11091 $ dispatcher ->expects ($ this ->exactly (2 ))
11192 ->method ('dispatch ' );
11293
113- $ object = $ this ->getMockForAbstractClass (AbstractApplication ::class);
94+ $ object = $ this ->createMock (TestAbstractApplicationObject ::class);
11495 $ object ->expects ($ this ->once ())
11596 ->method ('doExecute ' );
11697
@@ -131,7 +112,7 @@ public function testGet()
131112 ->enableProxyingToOriginalMethods ()
132113 ->getMock ();
133114
134- $ object = $ this -> getMockForAbstractClass (AbstractApplication::class, [ $ mockConfig] );
115+ $ object = new TestAbstractApplicationObject ( $ mockConfig );
135116
136117 $ this ->assertSame ('bar ' , $ object ->get ('foo ' , 'car ' ), 'Checks a known configuration setting is returned. ' );
137118 $ this ->assertSame ('car ' , $ object ->get ('goo ' , 'car ' ), 'Checks an unknown configuration setting returns the default. ' );
@@ -144,7 +125,7 @@ public function testGet()
144125 */
145126 public function testGetLogger ()
146127 {
147- $ object = $ this -> getMockForAbstractClass (AbstractApplication::class );
128+ $ object = new TestAbstractApplicationObject ( );
148129
149130 $ this ->assertInstanceOf (NullLogger::class, $ object ->getLogger ());
150131 }
@@ -160,7 +141,7 @@ public function testSet()
160141 ->enableProxyingToOriginalMethods ()
161142 ->getMock ();
162143
163- $ object = $ this -> getMockForAbstractClass (AbstractApplication::class, [ $ mockConfig] );
144+ $ object = new TestAbstractApplicationObject ( $ mockConfig );
164145
165146 $ this ->assertNull ($ object ->set ('foo ' , 'car ' ), 'Checks set returns the previous value. ' );
166147 $ this ->assertEquals ('car ' , $ object ->get ('foo ' ), 'Checks the new value has been set. ' );
@@ -173,7 +154,7 @@ public function testSet()
173154 */
174155 public function testSetConfiguration ()
175156 {
176- $ object = $ this -> getMockForAbstractClass (AbstractApplication::class );
157+ $ object = new TestAbstractApplicationObject ( );
177158 $ mockConfig = $ this ->createMock (Registry::class);
178159
179160 $ this ->assertSame ($ object , $ object ->setConfiguration ($ mockConfig ), 'The setConfiguration method has a fluent interface ' );
@@ -192,7 +173,7 @@ public function testSetConfiguration()
192173 */
193174 public function testSetLogger ()
194175 {
195- $ object = $ this -> getMockForAbstractClass (AbstractApplication::class );
176+ $ object = new TestAbstractApplicationObject ( );
196177 $ mockLogger = $ this ->createMock (LoggerInterface::class);
197178
198179 $ object ->setLogger ($ mockLogger );
0 commit comments