From a4352054d32f6a6b1e495a0b6e998c8319fe85c2 Mon Sep 17 00:00:00 2001 From: Maciej Holyszko <14310995+falkenhawk@users.noreply.github.com> Date: Mon, 5 Dec 2022 09:32:54 +0100 Subject: [PATCH] remove unnecessary Zend_Loader::loadClass for zf components. They are not needed since composer autoloader takes care of that. And they were breaking individual test runs e.g. `./vendor/bin/phpunit tests/Zend/Db/Adapter/MysqliTest.php` --- tests/Zend/Db/Adapter/Db2Test.php | 2 +- tests/Zend/Db/Adapter/TestCommon.php | 10 +++++----- tests/Zend/Db/Select/StaticTest.php | 4 ++-- tests/Zend/Db/Table/Select/StaticTest.php | 4 ++-- tests/Zend/Filter/InputTest.php | 22 +++++++++++----------- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tests/Zend/Db/Adapter/Db2Test.php b/tests/Zend/Db/Adapter/Db2Test.php index 645662d54..ce7491183 100644 --- a/tests/Zend/Db/Adapter/Db2Test.php +++ b/tests/Zend/Db/Adapter/Db2Test.php @@ -235,7 +235,7 @@ public function testAdapterAlternateStatement() */ public function testAdapterZendConfigEmptyDriverOptions() { - Zend_Loader::loadClass('Zend_Config'); + // Zend_Loader::loadClass('Zend_Config'); $params = $this->_util->getParams(); $params['driver_options'] = ''; $params = new Zend_Config($params); diff --git a/tests/Zend/Db/Adapter/TestCommon.php b/tests/Zend/Db/Adapter/TestCommon.php index 3bdb562aa..9814a1cfd 100644 --- a/tests/Zend/Db/Adapter/TestCommon.php +++ b/tests/Zend/Db/Adapter/TestCommon.php @@ -48,7 +48,7 @@ abstract class Zend_Db_Adapter_TestCommon extends Zend_Db_TestSetup */ public function testAdapterZendConfig() { - Zend_Loader::loadClass('Zend_Config'); + // Zend_Loader::loadClass('Zend_Config'); $params = new Zend_Config($this->_util->getParams()); $db = Zend_Db::factory($this->getDriver(), $params); @@ -61,7 +61,7 @@ public function testAdapterZendConfig() */ public function testAdapterZendConfigEmptyNamespace() { - Zend_Loader::loadClass('Zend_Config'); + // Zend_Loader::loadClass('Zend_Config'); $params = $this->_util->getParams(); $params['adapterNamespace'] = ''; $params = new Zend_Config($params); @@ -76,7 +76,7 @@ public function testAdapterZendConfigEmptyNamespace() */ public function testAdapterZendConfigEmptyDriverOptions() { - Zend_Loader::loadClass('Zend_Config'); + // Zend_Loader::loadClass('Zend_Config'); $params = $this->_util->getParams(); $params['driver_options'] = ''; $params = new Zend_Config($params); @@ -203,8 +203,8 @@ protected function _testAdapterConstructInvalidParam($param, $adapterClass = nul $params = $this->_util->getParams(); unset($params[$param]); - Zend_Loader::loadClass($adapterClass); - Zend_Loader::loadClass($exceptionClass); + // Zend_Loader::loadClass($adapterClass); + // Zend_Loader::loadClass($exceptionClass); try { $db = new $adapterClass($params); diff --git a/tests/Zend/Db/Select/StaticTest.php b/tests/Zend/Db/Select/StaticTest.php index d1121f2c4..c6cb393c2 100644 --- a/tests/Zend/Db/Select/StaticTest.php +++ b/tests/Zend/Db/Select/StaticTest.php @@ -61,7 +61,7 @@ public function testSelectQuery() $sql = preg_replace('/\\s+/', ' ', $select->__toString()); $this->assertEquals('SELECT "zfproducts".* FROM "zfproducts"', $sql); $stmt = $select->query(); - Zend_Loader::loadClass('Zend_Db_Statement_Static'); + // Zend_Loader::loadClass('Zend_Db_Statement_Static'); $this->assertTrue($stmt instanceof Zend_Db_Statement_Static); } @@ -77,7 +77,7 @@ public function testSelectQueryWithBinds() $this->assertEquals('SELECT "zfproducts".* FROM "zfproducts" WHERE (product_id = :product_id)', $sql); $stmt = $select->query(); - Zend_Loader::loadClass('Zend_Db_Statement_Static'); + // Zend_Loader::loadClass('Zend_Db_Statement_Static'); $this->assertTrue($stmt instanceof Zend_Db_Statement_Static); } diff --git a/tests/Zend/Db/Table/Select/StaticTest.php b/tests/Zend/Db/Table/Select/StaticTest.php index 7d67b5f52..cec297c7e 100644 --- a/tests/Zend/Db/Table/Select/StaticTest.php +++ b/tests/Zend/Db/Table/Select/StaticTest.php @@ -62,7 +62,7 @@ public function testSelectQuery() $sql = preg_replace('/\\s+/', ' ', $select->__toString()); $this->assertEquals('SELECT "zfproducts".* FROM "zfproducts"', $sql); $stmt = $select->query(); - Zend_Loader::loadClass('Zend_Db_Statement_Static'); + // Zend_Loader::loadClass('Zend_Db_Statement_Static'); $this->assertTrue($stmt instanceof Zend_Db_Statement_Static); } @@ -78,7 +78,7 @@ public function testSelectQueryWithBinds() $this->assertEquals('SELECT "zfproducts".* FROM "zfproducts" WHERE (product_id = :product_id)', $sql); $stmt = $select->query(); - Zend_Loader::loadClass('Zend_Db_Statement_Static'); + // Zend_Loader::loadClass('Zend_Db_Statement_Static'); $this->assertTrue($stmt instanceof Zend_Db_Statement_Static); } diff --git a/tests/Zend/Filter/InputTest.php b/tests/Zend/Filter/InputTest.php index 5c38c84c0..71d47379c 100644 --- a/tests/Zend/Filter/InputTest.php +++ b/tests/Zend/Filter/InputTest.php @@ -295,7 +295,7 @@ public function testFilterDeclareByObject() $data = array( 'month' => '6abc ' ); - Zend_Loader::loadClass('Zend_Filter_Digits'); + // Zend_Loader::loadClass('Zend_Filter_Digits'); $filters = array( 'month' => array(new Zend_Filter_Digits()) ); @@ -442,7 +442,7 @@ public function testValidatorDeclareByObject() $data = array( 'month' => '6' ); - Zend_Loader::loadClass('Zend_Validate_Digits'); + // Zend_Loader::loadClass('Zend_Validate_Digits'); $validators = array( 'month' => array( new Zend_Validate_Digits() @@ -498,7 +498,7 @@ public function testValidatorChain() 'field2' => 'abc123', 'field3' => 150, ); - Zend_Loader::loadClass('Zend_Validate_Between'); + // Zend_Loader::loadClass('Zend_Validate_Between'); $btw = new Zend_Validate_Between(1, 100); $validators = array( 'field1' => array('digits', $btw), @@ -527,7 +527,7 @@ public function testValidatorInvalidFieldInMultipleRules() $data = array( 'field2' => 'abc123', ); - Zend_Loader::loadClass('Zend_Validate_Between'); + // Zend_Loader::loadClass('Zend_Validate_Between'); $validators = array( 'field2a' => array( 'digits', @@ -705,7 +705,7 @@ public function testValidatorBreakChain() 'field2' => '150' ); - Zend_Loader::loadClass('Zend_Validate_Between'); + // Zend_Loader::loadClass('Zend_Validate_Between'); $btw1 = new Zend_Validate_Between(1, 100); @@ -1047,7 +1047,7 @@ public function testValidatorMessagesMultiple() $data = array('month' => '13abc'); $digitsMesg = 'Month should consist of digits'; $betweenMesg = 'Month should be between 1 and 12'; - Zend_Loader::loadClass('Zend_Validate_Between'); + // Zend_Loader::loadClass('Zend_Validate_Between'); $validators = array( 'month' => array( 'digits', @@ -1078,7 +1078,7 @@ public function testValidatorMessagesFieldsMultiple() $data = array('field1' => array('13abc', '234')); $digitsMesg = 'Field1 should consist of digits'; $betweenMesg = 'Field1 should be between 1 and 12'; - Zend_Loader::loadClass('Zend_Validate_Between'); + // Zend_Loader::loadClass('Zend_Validate_Between'); $validators = array( 'field1' => array( 'digits', @@ -1108,7 +1108,7 @@ public function testValidatorMessagesIntIndex() { $data = array('month' => '13abc'); $betweenMesg = 'Month should be between 1 and 12'; - Zend_Loader::loadClass('Zend_Validate_Between'); + // Zend_Loader::loadClass('Zend_Validate_Between'); $validators = array( 'month' => array( 'digits', @@ -1164,7 +1164,7 @@ public function testValidatorMessagesMultipleWithKeys() $data = array('month' => '13abc'); $digitsMesg = 'Month should consist of digits'; $betweenMesg = 'Month should be between 1 and 12'; - Zend_Loader::loadClass('Zend_Validate_Between'); + // Zend_Loader::loadClass('Zend_Validate_Between'); $validators = array( 'month' => array( 'digits', @@ -1195,7 +1195,7 @@ public function testValidatorMessagesMixedWithKeys() $data = array('month' => '13abc'); $digitsMesg = 'Month should consist of digits'; $betweenMesg = 'Month should be between 1 and 12'; - Zend_Loader::loadClass('Zend_Validate_Between'); + // Zend_Loader::loadClass('Zend_Validate_Between'); $validators = array( 'month' => array( 'digits', @@ -1582,7 +1582,7 @@ public function testOptionBreakChain() $data = array( 'field1' => '150' ); - Zend_Loader::loadClass('Zend_Validate_Between'); + // Zend_Loader::loadClass('Zend_Validate_Between'); $btw1 = new Zend_Validate_Between(1, 100); $btw2 = new Zend_Validate_Between(1, 125); $validators = array(