2017-04-15 23:00:24 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Created by PhpStorm.
|
|
|
|
* User: Lukas
|
|
|
|
* Date: 15. Apr. 2017
|
|
|
|
* Time: 22:44
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Tests\core\Update;
|
|
|
|
|
|
|
|
use ManiaControl\ManiaControl;
|
|
|
|
use ManiaControl\Utils\WebReader;
|
|
|
|
|
|
|
|
class PluginUpdateManagerTest extends \PHPUnit_Framework_TestCase {
|
2017-04-15 23:16:07 +02:00
|
|
|
public function testWebReaderAndPluginsWebservice() {
|
|
|
|
$url = ManiaControl::URL_WEBSERVICE . 'plugins';
|
|
|
|
$response = WebReader::getUrl($url);
|
|
|
|
$dataJson = $response->getContent();
|
|
|
|
|
|
|
|
$this->assertJson($dataJson);
|
|
|
|
|
|
|
|
$data = json_decode($dataJson);
|
|
|
|
|
|
|
|
$this->assertEquals(8, $data[0]->id);
|
|
|
|
$this->assertEquals("https://download.maniacontrol.com/plugins/8_Dedimania_Plugin_v0.1.zip", $data[0]->currentVersion->url);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetPluginUpdates() {
|
|
|
|
$maniaControl = new ManiaControl();
|
|
|
|
$updateManager = $maniaControl->getUpdateManager();
|
2017-04-15 23:00:24 +02:00
|
|
|
$pluginUpdateManager = $updateManager->getPluginUpdateManager();
|
|
|
|
|
2017-04-15 23:16:07 +02:00
|
|
|
//No Plugins Running so No new Updates
|
|
|
|
$this->assertFalse($pluginUpdateManager->getPluginsUpdates());
|
|
|
|
|
|
|
|
$maniaControl->run(5);
|
2017-04-15 23:00:24 +02:00
|
|
|
|
2017-04-15 23:16:07 +02:00
|
|
|
$this->assertNotFalse($pluginUpdateManager->getPluginsUpdates());
|
|
|
|
//TODO load Plugin manually and then test (could happen that no update is existing)
|
2017-04-15 23:00:24 +02:00
|
|
|
}
|
|
|
|
}
|