-
Notifications
You must be signed in to change notification settings - Fork 107
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
Implement sync proxy metadata command #224
Conversation
Codecov Report
@@ Coverage Diff @@
## static-proxy #224 +/- ##
==================================================
+ Coverage 99.82% 99.87% +0.05%
- Complexity 1401 1417 +16
==================================================
Files 233 234 +1
Lines 4030 4069 +39
==================================================
+ Hits 4023 4064 +41
+ Misses 7 5 -2
Continue to review full report at Codecov.
|
if ($version === $packageData['version']) { | ||
$this->filesystem->write($this->distPath($package, $lastDist['reference'], $lastDist['type']), $this->downloader->getContents($lastDist['url']) | ||
$path = $this->distPath($package, $lastDist['reference'], $lastDist['type']); | ||
if ($version === $packageData['version'] && !$this->filesystem->has($path)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added check if version already exist (without this $this->filesystem->write
will throw exception)
@@ -9,8 +9,14 @@ | |||
|
|||
final class FakeDownloader implements Downloader | |||
{ | |||
// todo: remove this and allow only for in-memory content to explicit control |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, this class is to magical, while rewriting the tests, I was able to be surprised more than once, because the file system is not defined in the code
{ | ||
$dist = new Dist('repo', 'package', 'dev-master/feature', '123456', 'zip'); | ||
|
||
self::assertEquals(md5('dev-master/feature'), $dist->version()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more coverage 💪
@@ -71,6 +71,7 @@ | |||
"ekino/phpstan-banned-code": "^0.3.1", | |||
"friendsofphp/php-cs-fixer": "^2.16", | |||
"fzaninotto/faker": "^1.9", | |||
"league/flysystem-memory": "^1.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will allow to write cleaner and faster tests
foreach ($files as $file) { | ||
$url = sprintf('%s://%s', parse_url($this->url, PHP_URL_SCHEME), $file['path']); | ||
// todo: what if proxy do not return `Last-Modified` header? | ||
if ($this->downloader->getLastModified($url)->getOrElse(0) > ($file['timestamp'] ?? time())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
slow performance, maybe we can speed this up with @reactphp 😎
No description provided.