Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Grotax committed Jan 8, 2025
1 parent df01931 commit b7b61eb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/Config/FetcherConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function __construct(

$this->logger->debug(
'Proxy configuration finalized: {proxy}',
['proxy' => $proxy]
['proxy' => $this->proxy]
);

return $this;
Expand Down Expand Up @@ -198,4 +198,14 @@ public function getUserAgent(): string

return 'NextCloud-News/' . $this->version;
}

/**
* Get the proxy configuration
*
* @return string|null
*/
public function getProxy(): ?string
{
return $this->proxy;
}
}
25 changes: 25 additions & 0 deletions tests/Unit/Config/FetcherConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,4 +122,29 @@ public function testGetUserAgentUnknownVersion()
$response = $this->class->getUserAgent();
$this->assertEquals($expected, $response);
}

public function testProxyPortPreserved()
{
$this->config->expects($this->exactly(2))
->method('getValueInt')
->willReturnMap([
['news', 'feedFetcherTimeout', 60, false, 60],
['news', 'maxRedirects', 10, false, 10]
]);

$this->appmanager->expects($this->exactly(1))
->method('getAppVersion')
->willReturn('1.0');

$this->sysconfig->expects($this->exactly(1))
->method('getSystemValue')
->with('proxy')
->willReturn('http://192.168.178.1:80');

$this->class = new FetcherConfig($this->config, $this->sysconfig, $this->appmanager, $this->logger);

$expected = 'http://192.168.178.1:80';
$response = $this->class->getProxy();
$this->assertEquals($expected, $response);
}
}

0 comments on commit b7b61eb

Please sign in to comment.