Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"Featurevisor\\": "src/"
},
"files": [
"src/index.php"
"src/functions.php"
]
},
"autoload-dev": {
Expand All @@ -46,7 +46,7 @@
"featurevisor"
],
"scripts": {
"test": "phpunit --bootstrap tests/bootstrap.php tests"
"test": "phpunit tests"
},
"license": [
"MIT"
Expand Down
2 changes: 1 addition & 1 deletion featurevisor
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<?php

require __DIR__ . '/vendor/autoload.php';
require __DIR__ . '/src/index.php';

use function Featurevisor\createInstance;

Expand Down Expand Up @@ -471,6 +470,7 @@ function assessDistribution(array $cliOptions) {
$populateUuid = $cliOptions['populateUuid'];

$datafilesByEnvironment = buildDatafiles($featurevisorProjectPath, [$cliOptions['environment']]);
$level = getLoggerLevel($cliOptions);

$f = createInstance([
'datafile' => $datafilesByEnvironment[$cliOptions['environment']],
Expand Down
1 change: 0 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="tests/bootstrap.php"
colors="true"
processIsolation="false"
stopOnFailure="false"
Expand Down
5 changes: 0 additions & 5 deletions src/Instance.php
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,3 @@ public function getAllEvaluations(array $context = [], array $featureKeys = [],
return $evaluations;
}
}

function createInstance(array $options = []): Instance
{
return new Instance($options);
}
5 changes: 0 additions & 5 deletions src/Logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,3 @@ public static function defaultLogHandler(string $level, string $message, $detail
echo PHP_EOL;
}
}

function createLogger(array $options = []): Logger
{
return new Logger($options);
}
13 changes: 13 additions & 0 deletions src/functions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

namespace Featurevisor;

function createInstance(array $options = []): Instance
{
return new Instance($options);
}

function createLogger(array $options = []): Logger
{
return new Logger($options);
}
42 changes: 0 additions & 42 deletions src/index.php

This file was deleted.

9 changes: 2 additions & 7 deletions tests/BucketerTest.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
<?php

namespace Featurevisor\Tests;

use PHPUnit\Framework\TestCase;
require_once __DIR__ . '/../src/Bucketer.php';
require_once __DIR__ . '/../src/Logger.php';

use Featurevisor\Bucketer;
use Featurevisor\Logger;
use function Featurevisor\createLogger;

class BucketerTest extends TestCase {
public function testGetBucketedNumberIsFunction() {
// In PHP, it's a static method
$this->assertTrue(is_callable([Bucketer::class, 'getBucketedNumber']));
}

public function testGetBucketedNumberRange() {
$keys = ['foo', 'bar', 'baz', '123adshlk348-93asdlk'];
Expand Down
5 changes: 2 additions & 3 deletions tests/ChildTest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<?php

namespace Featurevisor\Tests;

use PHPUnit\Framework\TestCase;
require_once __DIR__ . '/../src/Child.php';
require_once __DIR__ . '/../src/Instance.php';
require_once __DIR__ . '/../src/index.php';

use function Featurevisor\createInstance;

Expand Down
10 changes: 3 additions & 7 deletions tests/ConditionsTest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Featurevisor\Tests;

use DateTime;
use PHPUnit\Framework\TestCase;
require_once __DIR__ . '/../src/Conditions.php';
require_once __DIR__ . '/../src/DatafileReader.php';
require_once __DIR__ . '/../src/Logger.php';

use Featurevisor\DatafileReader;
use function Featurevisor\createLogger;
Expand All @@ -24,10 +24,6 @@ protected function setUp(): void {
]);
}

public function testAllConditionsAreMatchedIsFunction() {
$this->assertTrue(is_callable([$this->datafileReader, 'allConditionsAreMatched']));
}

public function testMatchAllViaStar() {
$this->assertTrue($this->datafileReader->allConditionsAreMatched('*', ['browser_type' => 'chrome']));
$this->assertFalse($this->datafileReader->allConditionsAreMatched('blah', ['browser_type' => 'chrome']));
Expand Down
7 changes: 2 additions & 5 deletions tests/DatafileReaderTest.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<?php

namespace Featurevisor\Tests;

use PHPUnit\Framework\TestCase;
require_once __DIR__ . '/../src/DatafileReader.php';
require_once __DIR__ . '/../src/Logger.php';

use Featurevisor\DatafileReader;
use function Featurevisor\createLogger;

class DatafileReaderTest extends TestCase {
public function testDatafileReaderIsFunction() {
$this->assertTrue(class_exists(DatafileReader::class));
}

public function testV2DatafileSchemaEntities() {
$datafileJson = [
Expand Down
3 changes: 2 additions & 1 deletion tests/EmitterTest.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?php

namespace Featurevisor\Tests;

use PHPUnit\Framework\TestCase;
require_once __DIR__ . '/../src/Emitter.php';

use Featurevisor\Emitter;

Expand Down
2 changes: 2 additions & 0 deletions tests/EventsTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Featurevisor\Tests;

use PHPUnit\Framework\TestCase;

use Featurevisor\Events;
Expand Down
9 changes: 0 additions & 9 deletions tests/IndexTest.php

This file was deleted.

2 changes: 2 additions & 0 deletions tests/InstanceTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Featurevisor\Tests;

use PHPUnit\Framework\TestCase;

use function Featurevisor\createInstance;
Expand Down
2 changes: 2 additions & 0 deletions tests/LoggerTest.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

namespace Featurevisor\Tests;

use PHPUnit\Framework\TestCase;

use Featurevisor\Logger;
Expand Down
10 changes: 0 additions & 10 deletions tests/bootstrap.php

This file was deleted.