Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
No background and logo in 10
  • Loading branch information
nickvergessen committed Sep 6, 2016
commit 996f2019f7e84453da34096a2f916a6dd0664ade
10 changes: 1 addition & 9 deletions apps/theming/lib/capabilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,11 @@ class Capabilities implements ICapability {
/** @var ThemingDefaults */
protected $theming;


/** @var IURLGenerator */
protected $url;

/**
* @param ThemingDefaults $theming
* @param IURLGenerator $url
*/
public function __construct(ThemingDefaults $theming, IURLGenerator $url) {
public function __construct(ThemingDefaults $theming) {
$this->theming = $theming;
$this->url = $url;
}

/**
Expand All @@ -61,8 +55,6 @@ public function getCapabilities() {
'url' => $this->theming->getBaseUrl(),
'slogan' => $this->theming->getSlogan(),
'color' => $this->theming->getMailHeaderColor(),
'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()),
'background' => $this->url->getAbsoluteURL($this->theming->getBackground()),
],
];
}
Expand Down
32 changes: 4 additions & 28 deletions apps/theming/tests/CapabilitiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ class CapabilitiesTest extends TestCase {
/** @var ThemingDefaults|\PHPUnit_Framework_MockObject_MockObject */
protected $theming;

/** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */
protected $url;

/** @var Capabilities */
protected $capabilities;

Expand All @@ -48,29 +45,23 @@ protected function setUp() {
$this->theming = $this->getMockBuilder('OCA\Theming\ThemingDefaults')
->disableOriginalConstructor()
->getMock();
$this->url = $this->getMockBuilder('OCP\IURLGenerator')
->getMock();

$this->capabilities = new Capabilities($this->theming, $this->url);
$this->capabilities = new Capabilities($this->theming);
}

public function dataGetCapabilities() {
return [
['name', 'url', 'slogan', 'color', 'logo', 'background', 'http://absolute/', [
['name', 'url', 'slogan', 'color', [
'name' => 'name',
'url' => 'url',
'slogan' => 'slogan',
'color' => 'color',
'logo' => 'http://absolute/logo',
'background' => 'http://absolute/background',
]],
['name1', 'url2', 'slogan3', 'color4', 'logo5', 'background6', 'http://localhost/', [
['name1', 'url2', 'slogan3', 'color4', [
'name' => 'name1',
'url' => 'url2',
'slogan' => 'slogan3',
'color' => 'color4',
'logo' => 'http://localhost/logo5',
'background' => 'http://localhost/background6',
]],
];
}
Expand All @@ -81,12 +72,9 @@ public function dataGetCapabilities() {
* @param string $url
* @param string $slogan
* @param string $color
* @param string $logo
* @param string $background
* @param string $baseUrl
* @param string[] $expected
*/
public function testGetCapabilities($name, $url, $slogan, $color, $logo, $background, $baseUrl, array $expected) {
public function testGetCapabilities($name, $url, $slogan, $color, array $expected) {
$this->theming->expects($this->once())
->method('getName')
->willReturn($name);
Expand All @@ -99,18 +87,6 @@ public function testGetCapabilities($name, $url, $slogan, $color, $logo, $backgr
$this->theming->expects($this->once())
->method('getMailHeaderColor')
->willReturn($color);
$this->theming->expects($this->once())
->method('getLogo')
->willReturn($logo);
$this->theming->expects($this->once())
->method('getBackground')
->willReturn($background);

$this->url->expects($this->exactly(2))
->method('getAbsoluteURL')
->willReturnCallback(function($url) use($baseUrl) {
return $baseUrl . $url;
});

$this->assertEquals(['theming' => $expected], $this->capabilities->getCapabilities());
}
Expand Down