| 1 | <?php |
||
| 8 | class ConfigServiceTest extends \Test\TestCase { |
||
| 9 | |||
| 10 | private $config; |
||
| 11 | private $service; |
||
| 12 | |||
| 13 | public function setUp() { |
||
| 14 | $this->config = $this->getMockBuilder('\OCP\IConfig') |
||
| 15 | ->disableOriginalConstructor()->getMock(); |
||
| 16 | $this->service = new ConfigService($this->config, 'apporder'); |
||
| 17 | } |
||
| 18 | |||
| 19 | public function testAppValue() { |
||
| 20 | $this->config->expects($this->any()) |
||
| 21 | ->method('getAppValue') |
||
| 22 | ->with('apporder', 'foo') |
||
| 23 | ->willReturn('bar'); |
||
| 24 | // $this->service->setAppValue("foo","bar"); |
||
| 25 | $result = $this->service->getAppValue("foo"); |
||
| 26 | $this->assertEquals('bar', $result); |
||
| 27 | } |
||
| 28 | |||
| 29 | public function testUserValue() { |
||
| 30 | $this->config->expects($this->any()) |
||
| 31 | ->method('getUserValue') |
||
| 32 | ->with('user', 'apporder', 'foo') |
||
| 33 | ->willReturn('bar'); |
||
| 34 | $this->service->setUserValue("foo", "user", "bar"); |
||
| 35 | $result = $this->service->getUserValue("foo", "user"); |
||
| 36 | $this->assertEquals('bar', $result); |
||
| 37 | } |
||
| 38 | |||
| 39 | } |
||
| 40 |