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

Additional Cleanup for Building in PHP 7.0 #183

Merged
merged 19 commits into from
Jul 19, 2017

Conversation

chakrabortyr
Copy link
Contributor

Description

Added explicit requires, removed unused 'external_libraries' reference that was breaking the build. Should be pretty minor changes all around, mostly involved cleanup. Only noteworthy change I can think of was removing some concatenation with variables outside of the context in which they'd be known (Line 93, configuration/linker.php)

Motivation and Context

Cleanup to get it to build properly with PHP 7.0

Tests performed

Rebuilt XDMOD + ran tests in the open_xdmod module

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project as found in the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@chakrabortyr
Copy link
Contributor Author

lemme put this on hold, run_tests.sh seems to work fine.

@smgallo
Copy link
Contributor

smgallo commented Jul 17, 2017

Looks like a style issue. Run PHPCS on any files that you modified (E.g., ~/src/xdmod/vendor/bin/phpcs <file>)

@@ -15,6 +15,7 @@
// Register a custom autoloader for XDMoD components.
$include_path = ini_get('include_path');
$include_path .= ":" . $baseDir . '/classes';
$include_path .= ":" . $baseDir . '/classes/CCR';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that we want to make this change to the linker. This effectively changes the interpretation of the namespaces, which I don't think is a good idea.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have files that are incorrectly referencing the wrong namespace then please fix those files.

$logConf = array('mode' => 0644);
$logger = Log::factory('file', $logfile, 'exception', $logConf);
$logConf = array('mode' => 0644);
$logger = Log::factory($logfile, $logConf);
Copy link
Member

@jpwhite4 jpwhite4 Jul 18, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change this function call? Originally the code used the PEAR::Log factory function to generate a file logger. Now you have changed it to use a CCR::Log factory function that does something completely different. Please revert this change.

@@ -2,6 +2,7 @@

namespace CCR;

require_once 'System.php';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What bug this this change intended to fix?

@@ -18,3 +18,5 @@ build:
- composer install --no-progress
- cp ~/assets/secrets open_xdmod/modules/xdmod/integration_tests/.secrets
- ./open_xdmod/modules/xdmod/integration_tests/runtests.sh --log-junit `pwd`/shippable/testresults/results.xml
on_failure:
- cat /var/log/xdmod/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there should be a newline at the end of this file.

@chakrabortyr
Copy link
Contributor Author

As of PHP 7.1.x, looks like they replaced InvalidArgumentException with ArgumentCountError (REF: http://php.net/manual/en/class.argumentcounterror.php). This causes IdentityTest::testNoDefaultParameterToConstructor() to look like it's failing, even though it's just using a different exception than prior versions.

Since fixing this would break the test's compatibility for versions we presently support, I'd say accept it for now. Thoughts?

@smgallo
Copy link
Contributor

smgallo commented Jul 18, 2017

From the docs: ArgumentCountError is thrown "when too few arguments are passed to a user-defined function or method." and was added in PHP 7.1 while InvalidArgumentException is thrown "if an argument is not of the expected type". It looks like 7.1 now explicitly handles each case. Can PHPUnit run different tests or expect different results based on the version of PHP that is running?

@chakrabortyr
Copy link
Contributor Author

chakrabortyr commented Jul 18, 2017

Sorry, not redundant in the sense that there's a test that does something similar, it just seems to be testing a feature of the language itself rather than any code specific to xdmod. It can be assumed that when you initialize a constructor without a parameter (where the constructor specifies for one), that it should fail. So I see it as redundant in that it doesn't seem to test anything specific.

@smgallo
Copy link
Contributor

smgallo commented Jul 18, 2017

I don't think removing the entire set of tests is a good way to deal with the exception changes in PHP7. There are other valid tests in that file for the Identity class that should not be removed. Even testNoDefaultParameterToConstructor() tests to ensure that a parameter is required. Perhaps expecting BadMethodCallException (Exception thrown if a callback refers to an undefined method or if some arguments are missing) is a better solution.

@chakrabortyr chakrabortyr merged commit afa860f into ubccr:xdmod7.0 Jul 19, 2017
@chakrabortyr chakrabortyr deleted the php7build branch July 19, 2017 15:24
@tyearke tyearke added bug Bugfixes qa labels Aug 14, 2017
@tyearke tyearke added this to the v7.0.0 milestone Aug 14, 2017
@plessbd plessbd added the qa / testing Updates/additions to tests label Mar 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bugfixes qa / testing Updates/additions to tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants