Skip to content

Commit

Permalink
update bootstrap to set constants
Browse files Browse the repository at this point in the history
  • Loading branch information
bueltge committed Sep 12, 2019
1 parent cf10454 commit 255e6c9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 9 deletions.
22 changes: 15 additions & 7 deletions tests/php/bootstrap.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
<?php # -*- coding: utf-8 -*-
$vendor = dirname(__DIR__, 2) . '/vendor/';
if (!file_exists($vendor . 'autoload.php')) {
die("Please install via Composer before running tests.");
/** @noinspection PhpIncludeInspection */
declare(strict_types=1);

putenv('TESTS_PATH='.__DIR__);
putenv('LIBRARY_PATH='.dirname(__DIR__));

$vendor = dirname(__DIR__, 2).'/vendor/';
if (!realpath($vendor)) {
die('Please install via Composer before running tests.');
}

require_once $vendor . 'brain/monkey/inc/patchwork-loader.php';
require_once $vendor . 'autoload.php';
unset($vendor);
if (!defined('PHPUNIT_COMPOSER_INSTALL')) {
define('PHPUNIT_COMPOSER_INSTALL', $vendor.'autoload.php');
}

putenv('TESTS_PATH=' . __DIR__);
require_once $vendor.'brain/monkey/inc/patchwork-loader.php';
require_once $vendor.'autoload.php';
unset($vendor);
1 change: 1 addition & 0 deletions tests/php/unit/AssetsTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php # -*- coding: utf-8 -*-
declare(strict_types=1);
// phpcs:disable

namespace MultisiteGlobalMedia\Tests\Unit;
Expand Down
4 changes: 3 additions & 1 deletion tests/php/unit/AttachmentTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php # -*- coding: utf-8 -*-
declare(strict_types=1);
// phpcs:disable

namespace MultisiteGlobalMedia\Tests\Unit;
Expand All @@ -8,8 +9,9 @@
use MultisiteGlobalMedia\Attachment;
use MultisiteGlobalMedia\Site;
use MultisiteGlobalMedia\SiteSwitcher;
use MultisiteGlobalMedia\Tests\TestCase;

class AttachmentTest extends \MultisiteGlobalMedia\Tests\TestCase
class AttachmentTest extends TestCase
{
public function testInstance()
{
Expand Down
8 changes: 7 additions & 1 deletion tests/php/unit/SiteTest.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
<?php # -*- coding: utf-8 -*-
declare(strict_types=1);
// phpcs:disable

namespace MultisiteGlobalMedia\Tests\Unit;

use Brain\Monkey\Filters;
use MultisiteGlobalMedia\Site;
use MultisiteGlobalMedia\Tests\TestCase;
use PHPUnit\Framework\Exception;

class SiteTest extends TestCase
{
public function testInstance()
{
$testee = new Site();

self::assertInstanceOf(Site::class, $testee);
try {
self::assertInstanceOf(Site::class, $testee);
} catch (Exception $e) {
echo $e->getMessage();
}
}

public function testSiteIdFilterIsApplied()
Expand Down

0 comments on commit 255e6c9

Please sign in to comment.