Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

At Zend_Test_PHPUnit_ControllerTestCase, added a class alias... #403

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions library/Zend/Test/PHPUnit/ControllerTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@
/** @see Zend_Registry */
require_once 'Zend/Registry.php';

if (!class_exists('PHPUnit_Framework_TestCase')) {
if (class_exists('Yoast\PHPUnitPolyfills\TestCases\TestCase')) {
class_alias('Yoast\PHPUnitPolyfills\TestCases\TestCase', 'PHPUnit_Framework_TestCase');
} elseif (class_exists('PHPUnit\Framework\TestCase')) {
class_alias('PHPUnit\Framework\TestCase', 'PHPUnit_Framework_TestCase');
}
}

/**
* Functional testing scaffold for MVC applications
*
Expand All @@ -43,6 +51,10 @@
* @subpackage PHPUnit
* @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*
* @property-read Zend_Controller_Request_HttpTestCase $request
* @property-read Zend_Controller_Response_HttpTestCase $response
* @property-read Zend_Controller_Front $frontController
*/
abstract class Zend_Test_PHPUnit_ControllerTestCase extends PHPUnit_Framework_TestCase
{
Expand Down Expand Up @@ -125,6 +137,18 @@ protected function setUp(): void
$this->bootstrap();
}

/**
* Set up MVC app
*
* Calls {@link bootstrap()} by default
*
* Version intended for use when extending from Yoast\PHPUnitPolyfills\TestCases\TestCase
*/
protected function set_up()
{
$this->bootstrap();
}

/**
* Bootstrap the front controller
*
Expand Down
2 changes: 1 addition & 1 deletion tests/Zend/Layout/AllTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static function suite()
$suite->addTestSuite('Zend_Layout_LayoutTest');
$suite->addTestSuite('Zend_Layout_HelperTest');
$suite->addTestSuite('Zend_Layout_PluginTest');
// $suite->addTestSuite('Zend_Layout_FunctionalTest');
$suite->addTestSuite('Zend_Layout_FunctionalTest');

return $suite;
}
Expand Down
5 changes: 5 additions & 0 deletions tests/Zend/Test/PHPUnit/ControllerTestCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,11 @@ public function providerRedirectWorksAsExpectedFromHookMethodsInFrontControllerP
// Concrete test case class for testing purposes
class Zend_Test_PHPUnit_ControllerTestCaseTest_Concrete extends Zend_Test_PHPUnit_ControllerTestCase
{
// Added to elevate the otherwise protected method to a public one
public function set_up()
{
parent::set_up();
}
}

// Call Zend_Test_PHPUnit_ControllerTestCaseTest::main() if this source file is executed directly.
Expand Down
Loading