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

Tdr 22/get depencencies from composer #764

Merged
merged 32 commits into from
Feb 12, 2021

Conversation

hutnikau
Copy link
Contributor

@hutnikau hutnikau commented Apr 7, 2020

No description provided.

common/ext/class.ExtensionsManager.php Outdated Show resolved Hide resolved
common/oatbox/extension/ComposerInfo.php Outdated Show resolved Hide resolved
helpers/class.ExtensionHelper.php Show resolved Hide resolved
test/unit/ManifestTest.php Show resolved Hide resolved
ks16
ks16 previously requested changes Apr 20, 2020
Copy link
Contributor

@ks16 ks16 left a comment

Choose a reason for hiding this comment

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

Some suggestions/ideas and failed tests.

common/oatbox/extension/ComposerInfo.php Outdated Show resolved Hide resolved
common/oatbox/extension/ComposerInfo.php Show resolved Hide resolved
common/oatbox/extension/ComposerInfo.php Outdated Show resolved Hide resolved
* @throws ManifestNotFoundException
* @throws exception\MalformedManifestException
*/
public function __construct($filePath, ComposerInfo $composerInfo = null)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better to pass directory name instead of manifest file path here. This class is more suitable for manifest fine name constant, than common_ext_Extension and later in the code we use directory name to read composer files.

helpers/class.ExtensionHelper.php Outdated Show resolved Hide resolved
scripts/update/Updater.php Outdated Show resolved Hide resolved
test/unit/extension/ComposerInfoTest.php Outdated Show resolved Hide resolved
test/unit/extension/ComposerInfoTest.php Outdated Show resolved Hide resolved
@gitromba gitromba self-requested a review December 9, 2020 09:06
Copy link
Contributor

@gitromba gitromba left a comment

Choose a reason for hiding this comment

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

composer.lock is meant to be for internal usage for Composer and its structure can vary from release to release.
Instead it's strongly advised to build on Composer's public API which has been introduced with Composer 2 and being supported by TAO.

@hutnikau now that we have Composer 2 support, please consider updating the PR to be built on a standard and reliable API.

@hutnikau
Copy link
Contributor Author

composer.lock is meant to be for internal usage for Composer and its structure can vary from release to release.
Instead it's strongly advised to build on Composer's public API which has been introduced with Composer 2 and being supported by TAO.

@hutnikau now that we have Composer 2 support, please consider updating the PR to be built on a standard and reliable API.

I pushed a commit with usage of composer API, but unfortunately it does not provide full information about the package, so we still need to read lock file (to get extra data from there).

@Babacooll Babacooll self-requested a review January 14, 2021 10:42
@gitromba
Copy link
Contributor

I'm having failing unit tests locally:

❯ vendor/bin/phpunit generis/test/unit/extension/ComposerInfoTest.php
PHPUnit 8.5.13 by Sebastian Bergmann and contributors.

.E..                                                                4 / 4 (100%)

Time: 35 ms, Memory: 4.00 MB

There was 1 error:

1) oat\generis\test\unit\extension\ComposerInfoTest::testGetComposerLock
oat\oatbox\extension\exception\ManifestException: /Users/mihaly.hadju/repos/sandbox/generis/test/samples/manifests/composer.lock file not found

/Users/mihaly.hadju/repos/sandbox/generis/common/oatbox/extension/ComposerInfo.php:80
/Users/mihaly.hadju/repos/sandbox/generis/common/oatbox/extension/ComposerInfo.php:67
/Users/mihaly.hadju/repos/sandbox/generis/test/unit/extension/ComposerInfoTest.php:48

ERRORS!
Tests: 4, Assertions: 5, Errors: 1.

Copy link
Contributor

@gitromba gitromba left a comment

Choose a reason for hiding this comment

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

Thanks for the updates @hutnikau. This is an important milestone in the life of TAO :).

There are some comments left. Most of them are originated to ComposerInfo and its contract. Please check them out!

common/ext/class.ExtensionsManager.php Outdated Show resolved Hide resolved
common/oatbox/extension/ComposerInfo.php Show resolved Hide resolved
common/oatbox/extension/Manifest.php Outdated Show resolved Hide resolved
common/oatbox/extension/Manifest.php Outdated Show resolved Hide resolved
composer.json Show resolved Hide resolved
@gitromba
Copy link
Contributor

FYI @hutnikau: The corresponding PR CI build is tested with Composer 2. Looks okay, but there are broken tests .

Copy link
Contributor

@gitromba gitromba left a comment

Choose a reason for hiding this comment

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

Thanks for the quick update @hutnikau!

I have a failing unit test, please have a look:

❯ vendor/bin/phpunit generis/test/unit --bootstrap generis/test/bootstrap.php
PHPUnit 8.5.14 by Sebastian Bergmann and contributors.

...............................................................  63 / 308 ( 20%)
SSSSSSSS....................................................... 126 / 308 ( 40%)
..................SSSSSSSSSSSS................................. 189 / 308 ( 61%)
....................EF......................................... 252 / 308 ( 81%)
........................................................        308 / 308 (100%)

Time: 12.69 seconds, Memory: 24.00 MB

There was 1 error:

1) oat\generis\test\unit\extension\ComposerInfoTest::testGetAvailableTaoExtensions
common_ext_ExtensionException: Composer lock file missed at /composer.lock

/Users/mihaly.hadju/repos/sandbox/generis/common/oatbox/extension/ComposerInfo.php:156
/Users/mihaly.hadju/repos/sandbox/generis/common/oatbox/extension/ComposerInfo.php:78
/Users/mihaly.hadju/repos/sandbox/generis/test/unit/extension/ComposerInfoTest.php:43

--

There was 1 failure:

1) oat\generis\test\unit\extension\ComposerInfoTest::testExtractExtensionDependencies
Failed asserting that two arrays are equal.
--- Expected
+++ Actual
@@ @@
 Array (
-    'taoItemBank' => '*'
 )

/Users/mihaly.hadju/repos/sandbox/generis/test/unit/extension/ComposerInfoTest.php:49

ERRORS!
Tests: 308, Assertions: 960, Errors: 1, Failures: 1, Skipped: 20.

There's a comment on a - first glance - peculiar static call, which IMO requires further elaboration. Then from my side we are good to roll 🚀

common/ext/class.ExtensionsManager.php Outdated Show resolved Hide resolved
common/oatbox/extension/ComposerInfo.php Show resolved Hide resolved
Copy link
Contributor

@gitromba gitromba left a comment

Choose a reason for hiding this comment

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

Right in the finish line. Passing unit tests 🚀 Comments resolved 🚀 Thanks for the fun @hutnikau

@tikhanovichA tikhanovichA self-requested a review February 3, 2021 10:19
Copy link
Contributor

@tikhanovichA tikhanovichA left a comment

Choose a reason for hiding this comment

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

Review Checklist

  • New code is covered by tests (if applicable)
  • Tests are running successfully (old and new ones) on my local machine (if applicable)
  • New code is respecting code style rules
  • New code is respecting best practices
  • New code is not subject to concurrency issues (if applicable)
  • The feature is working correctly on my local machine (if applicable)
  • Acceptance criteria are respected
  • Pull request title and description are meaningful

@hutnikau hutnikau dismissed stale reviews from ks16 and Babacooll February 10, 2021 13:39

The changes were made in accordance with the comments.

@hutnikau hutnikau merged commit 046907e into develop Feb 12, 2021
@hutnikau hutnikau deleted the TDR-22/get_depencencies_from_composer branch February 12, 2021 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants