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

setupDatabase.php « support « screenshot-testing « lib « tests - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9f7bc0d3503e30ed2742119ec1e42483965ce5d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?php
/**
 * Piwik - Open source web analytics
 *
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
 */

$fixtureClass = "UITestFixture";
foreach ($argv as $arg) {
    if (strpos($arg, "--server=") === 0) {
        $serverStr = substr($arg, strlen("--server="));

        $_SERVER = json_decode($serverStr, true);
    } else if (strpos($arg, "--fixture=") === 0) {
        $fixtureClass = substr($arg, strlen("--fixture="));
    }
}

require_once "PHPUnit/Autoload.php";
require_once dirname(__FILE__) . "/../../../PHPUnit/bootstrap.php";

if (!empty($fixtureClass)) {
    if (!class_exists($fixtureClass)) {
        $fixtureClass = "Piwik\\Tests\\Fixtures\\$fixtureClass";
    }

    $fixture = new $fixtureClass();
    if (in_array("--persist-fixture-data", $argv)
        && get_class($fixture) != "Fixture"
    ) {
        $fixture->persistFixtureData = true;
    }
    if (in_array("--drop", $argv)) {
        $fixture->resetPersistedFixture = true;
    }
    $fixture->printToScreen = true;
    $fixture->performSetUp("");
}

// make sure symbolic links exist (phantomjs doesn't support symlink-ing yet)
foreach (array('libs', 'plugins', 'tests', 'piwik.js') as $linkName) {
    $linkPath = PIWIK_INCLUDE_PATH . '/tests/PHPUnit/proxy/' . $linkName;
    if (!file_exists($linkPath)) {
        symlink(PIWIK_INCLUDE_PATH . '/' . $linkName, $linkPath);
    }
}