Skip to content

Commit

Permalink
update scrutinizr config
Browse files Browse the repository at this point in the history
  • Loading branch information
nyamsprod committed Oct 10, 2018
1 parent 01a3c10 commit 3bd55b1
Show file tree
Hide file tree
Showing 11 changed files with 245 additions and 260 deletions.
29 changes: 7 additions & 22 deletions .scrutinizer.yml
@@ -1,32 +1,17 @@
build:
nodes:
analysis:
project_setup:
override: true
tests:
override:
- php-scrutinizer-run --enable-security-analysis
filter:
paths:
- src/
excluded_paths:
- tests/
paths: [src/*]
excluded_paths: [tests/*]
checks:
php:
code_rating: true
duplication: true
tools:
external_code_coverage:
timeout: 3600
runs: 2
timeout: 600
runs: 3
php_code_coverage: false
php_loc:
enabled: true
excluded_dirs:
- tests/
- vendor/
php_cpd: false
php_sim:
excluded_dirs: [tests, vendor]
php_cpd:
enabled: true
filter:
paths: ['src/']
excluded_dirs: [tests, vendor]
34 changes: 17 additions & 17 deletions tests/Components/DataPathTest.php
Expand Up @@ -11,7 +11,7 @@
* @group path
* @group datapath
*/
class DataPathTest extends TestCase
final class DataPathTest extends TestCase
{
/**
* @dataProvider invalidDataUriPath
Expand All @@ -37,7 +37,7 @@ public function testSetState()
{
$component = new Path('text/plain;charset=us-ascii,Bonjour%20le%20monde%21');
$generateComponent = eval('return '.var_export($component, true).';');
$this->assertEquals($component, $generateComponent);
self::assertEquals($component, $generateComponent);
}

public function invalidDataUriPath()
Expand All @@ -50,13 +50,13 @@ public function invalidDataUriPath()
public function testWithPath()
{
$uri = new Path('text/plain;charset=us-ascii,Bonjour%20le%20monde%21');
$this->assertSame($uri, $uri->withContent((string) $uri));
self::assertSame($uri, $uri->withContent((string) $uri));
}

public function testDebugInfo()
{
$component = new Path('text/plain;charset=us-ascii,Bonjour%20le%20monde%21');
$this->assertInternalType('array', $component->__debugInfo());
self::assertInternalType('array', $component->__debugInfo());
}

/**
Expand All @@ -66,7 +66,7 @@ public function testDebugInfo()
*/
public function testDefaultConstructor($path, $expected)
{
$this->assertSame($expected, (string) (new Path($path)));
self::assertSame($expected, (string) (new Path($path)));
}

public function validPathContent()
Expand Down Expand Up @@ -96,8 +96,8 @@ public function validPathContent()
public function testCreateFromPath($path, $mimetype, $mediatype)
{
$uri = Path::createFromPath(__DIR__.'/data/'.$path);
$this->assertSame($mimetype, $uri->getMimeType());
$this->assertSame($mediatype, $uri->getMediaType());
self::assertSame($mimetype, $uri->getMimeType());
self::assertSame($mediatype, $uri->getMediaType());
}

public function validFilePath()
Expand All @@ -112,15 +112,15 @@ public function testWithParameters()
{
$uri = new Path('text/plain;charset=us-ascii,Bonjour%20le%20monde%21');
$newUri = $uri->withParameters('charset=us-ascii');
$this->assertSame($newUri, $uri);
self::assertSame($newUri, $uri);
}

public function testWithParametersOnBinaryData()
{
$expected = 'charset=binary;foo=bar';
$uri = Path::createFromPath(__DIR__.'/data/red-nose.gif');
$newUri = $uri->withParameters($expected);
$this->assertSame($expected, $newUri->getParameters());
self::assertSame($expected, $newUri->getParameters());
}

/**
Expand Down Expand Up @@ -155,7 +155,7 @@ public function invalidParametersString()
*/
public function testToBinary($uri)
{
$this->assertTrue($uri->toBinary()->isBinaryData());
self::assertTrue($uri->toBinary()->isBinaryData());
}

/**
Expand All @@ -164,7 +164,7 @@ public function testToBinary($uri)
*/
public function testToAscii($uri)
{
$this->assertFalse($uri->toAscii()->isBinaryData());
self::assertFalse($uri->toAscii()->isBinaryData());
}

public function fileProvider()
Expand Down Expand Up @@ -199,9 +199,9 @@ public function testBinarySave()
$newFilePath = __DIR__.'/data/temp.gif';
$uri = Path::createFromPath(__DIR__.'/data/red-nose.gif');
$res = $uri->save($newFilePath);
$this->assertInstanceOf(SplFileObject::class, $res);
self::assertInstanceOf(SplFileObject::class, $res);
$res = null;
$this->assertSame((string) $uri, (string) Path::createFromPath($newFilePath));
self::assertSame((string) $uri, (string) Path::createFromPath($newFilePath));

// Ensure file handle of \SplFileObject gets closed.
$res = null;
Expand All @@ -213,10 +213,10 @@ public function testRawSave()
$newFilePath = __DIR__.'/data/temp.txt';
$uri = Path::createFromPath(__DIR__.'/data/hello-world.txt');
$res = $uri->save($newFilePath);
$this->assertInstanceOf(SplFileObject::class, $res);
$this->assertSame((string) $uri, (string) Path::createFromPath($newFilePath));
self::assertInstanceOf(SplFileObject::class, $res);
self::assertSame((string) $uri, (string) Path::createFromPath($newFilePath));
$data = file_get_contents($newFilePath);
$this->assertSame(base64_encode($data), $uri->getData());
self::assertSame(base64_encode($data), $uri->getData());

// Ensure file handle of \SplFileObject gets closed.
$res = null;
Expand All @@ -225,7 +225,7 @@ public function testRawSave()

public function testDataPathConstructor()
{
$this->assertSame('text/plain;charset=us-ascii,', (string) new Path());
self::assertSame('text/plain;charset=us-ascii,', (string) new Path());
}

public function testInvalidBase64Encoded()
Expand Down
20 changes: 10 additions & 10 deletions tests/Components/FragmentTest.php
Expand Up @@ -9,7 +9,7 @@
/**
* @group fragment
*/
class FragmentTest extends TestCase
final class FragmentTest extends TestCase
{
/**
* @dataProvider getUriComponentProvider
Expand All @@ -18,7 +18,7 @@ class FragmentTest extends TestCase
*/
public function testGetUriComponent($str, $encoded)
{
$this->assertSame($encoded, (new Fragment($str))->getUriComponent());
self::assertSame($encoded, (new Fragment($str))->getUriComponent());
}

public function getUriComponentProvider()
Expand All @@ -45,8 +45,8 @@ public function getUriComponentProvider()

public function testIsNull()
{
$this->assertTrue((new Fragment(null))->isNull());
$this->assertFalse((new Fragment(''))->isNull());
self::assertTrue((new Fragment(null))->isNull());
self::assertFalse((new Fragment(''))->isNull());
}

/**
Expand All @@ -57,7 +57,7 @@ public function testIsNull()
*/
public function testGetValue($str, $expected, $enc_type)
{
$this->assertSame($expected, (new Fragment($str))->getContent($enc_type));
self::assertSame($expected, (new Fragment($str))->getContent($enc_type));
}

public function geValueProvider()
Expand Down Expand Up @@ -85,7 +85,7 @@ public function geValueProvider()
*/
public function testGetContent($input, $enc_type, $expected)
{
$this->assertSame($expected, (new Fragment($input))->getContent($enc_type));
self::assertSame($expected, (new Fragment($input))->getContent($enc_type));
}

public function getContentProvider()
Expand All @@ -106,15 +106,15 @@ public function testInvalidEncodingTypeThrowException()

public function testDebugInfo()
{
$this->assertInternalType('array', (new Fragment('yolo'))->__debugInfo());
self::assertInternalType('array', (new Fragment('yolo'))->__debugInfo());
}

public function testPreserverDelimiter()
{
$fragment = new Fragment();
$altFragment = $fragment->withContent(null);
$this->assertSame($fragment, $altFragment);
$this->assertNull($altFragment->getContent());
$this->assertSame('', $altFragment->__toString());
self::assertSame($fragment, $altFragment);
self::assertNull($altFragment->getContent());
self::assertSame('', $altFragment->__toString());
}
}

0 comments on commit 3bd55b1

Please sign in to comment.