Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Steur <tsteur@users.noreply.github.com>2018-05-28 13:17:22 +0300
committerMatthieu Aubry <mattab@users.noreply.github.com>2018-05-28 13:17:22 +0300
commit51e725ede4378df7eeab296335ec5dab6a026b94 (patch)
treeb7b33133d41f4585ef9be6e61ca8047aeeaacc35
parent0e70009736f2a874d78aa3388d8cce2f65cfdb41 (diff)
Remove internal API example (#12996)
-rw-r--r--misc/others/api_internal_call.php33
-rw-r--r--tests/PHPUnit/System/ExternalScriptsTest.php46
-rw-r--r--tests/PHPUnit/proxy/include_single_file.php17
3 files changed, 0 insertions, 96 deletions
diff --git a/misc/others/api_internal_call.php b/misc/others/api_internal_call.php
deleted file mode 100644
index 1790f3b8d4..0000000000
--- a/misc/others/api_internal_call.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-use Piwik\API\Request;
-use Piwik\FrontController;
-
-define('PIWIK_INCLUDE_PATH', realpath('../..'));
-define('PIWIK_USER_PATH', realpath('../..'));
-define('PIWIK_ENABLE_DISPATCH', false);
-define('PIWIK_ENABLE_ERROR_HANDLER', false);
-define('PIWIK_ENABLE_SESSION_START', false);
-
-require_once PIWIK_INCLUDE_PATH . "/index.php";
-require_once PIWIK_INCLUDE_PATH . "/core/API/Request.php";
-
-$environment = new \Piwik\Application\Environment(null);
-$environment->init();
-
-FrontController::getInstance()->init();
-
-// This inits the API Request with the specified parameters
-$request = new Request('
- module=API
- &method=Resolution.getResolution
- &idSite=7
- &date=yesterday
- &period=week
- &format=XML
- &filter_limit=3
- &token_auth=anonymous
-');
-// Calls the API and fetch XML data back
-$result = $request->process();
-echo $result;
-
diff --git a/tests/PHPUnit/System/ExternalScriptsTest.php b/tests/PHPUnit/System/ExternalScriptsTest.php
deleted file mode 100644
index 950f2bb9e6..0000000000
--- a/tests/PHPUnit/System/ExternalScriptsTest.php
+++ /dev/null
@@ -1,46 +0,0 @@
-<?php
-/**
- * Piwik - free/libre analytics platform
- *
- * @link http://piwik.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- */
-namespace Piwik\Tests\System;
-
-use Piwik\DbHelper;
-use Piwik\Tests\Framework\Fixture;
-use Piwik\Tests\Framework\TestCase\SystemTestCase;
-
-class ExternalScriptsTest extends SystemTestCase
-{
- public static function setUpBeforeClass()
- {
- parent::setUpBeforeClass();
-
- DbHelper::createAnonymousUser();
-
- // the api_internal_call.php uses idSite=7, so we create 7 sites
- for ($i = 0; $i != 7; ++$i) {
- Fixture::createWebsite("2011-01-01 00:00:00", $ecommerce = 1, $siteName = "Site #$i");
- }
-
- // the script uses anonymous token auth, so give the anonymous user access
- \Piwik\Plugins\UsersManager\API::getInstance()->setUserAccess('anonymous', 'view', array(7));
- }
-
- public function test_ApiInternalCallScript_ExecutesCorrectly()
- {
- $output = $this->executeApiInternalCall();
- $expectedFileOutput = "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<result />";
- $this->assertEquals($expectedFileOutput, $output);
- }
-
- private function executeApiInternalCall()
- {
- $proxyIncludeScript = PIWIK_INCLUDE_PATH . '/tests/PHPUnit/proxy/include_single_file.php';
- $apiInternalCallScript = PIWIK_INCLUDE_PATH . '/misc/others/api_internal_call.php';
-
- $command = "php '$proxyIncludeScript' '$apiInternalCallScript' 2>&1";
- return shell_exec($command);
- }
-}
diff --git a/tests/PHPUnit/proxy/include_single_file.php b/tests/PHPUnit/proxy/include_single_file.php
deleted file mode 100644
index f8fc98043b..0000000000
--- a/tests/PHPUnit/proxy/include_single_file.php
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php
-
-use Piwik\Application\Environment;
-use Piwik\Tests\Framework\TestingEnvironmentManipulator;
-use Piwik\Tests\Framework\TestingEnvironmentVariables;
-
-require_once __DIR__ . '/../../../core/Application/Environment.php';
-require_once __DIR__ . '/../../../core/Application/Kernel/PluginList.php';
-require_once __DIR__ . '/../../../core/Application/EnvironmentManipulator.php';
-require_once __DIR__ . '/../Framework/TestingEnvironmentVariables.php';
-require_once __DIR__ . '/../Framework/TestingEnvironmentManipulator.php';
-
-Environment::setGlobalEnvironmentManipulator(new TestingEnvironmentManipulator(new TestingEnvironmentVariables()));
-
-$scriptToInclude = $argv[1];
-
-include $scriptToInclude;