-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
smoench
committed
Oct 2, 2019
1 parent
68e6027
commit f26b916
Showing
11 changed files
with
261 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ junit-report.xml | |
.php_cs.cache | ||
.deptrac.cache | ||
.phpunit.result.cache | ||
infection.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"timeout": 10, | ||
"source": { | ||
"directories": [ | ||
"src" | ||
] | ||
}, | ||
"logs": { | ||
"text": "infection.log" | ||
}, | ||
"mutators": { | ||
"@default": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
tests/AstRunner/AstParser/NikicPhpParser/NikicPhpParserTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\SensioLabs\Deptrac\AstRunner\AstParser\NikicPhpParser; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use SensioLabs\Deptrac\AstRunner\AstParser\AstFileReferenceCache; | ||
use SensioLabs\Deptrac\AstRunner\AstParser\NikicPhpParser\FileParser; | ||
use SensioLabs\Deptrac\AstRunner\AstParser\NikicPhpParser\NikicPhpParser; | ||
|
||
class NikicPhpParserTest extends TestCase | ||
{ | ||
/** @var NikicPhpParser */ | ||
private $parser; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this->parser = new NikicPhpParser( | ||
$this->createMock(FileParser::class), | ||
$this->createMock(AstFileReferenceCache::class) | ||
); | ||
} | ||
|
||
public function testSupport(): void | ||
{ | ||
static::assertTrue($this->parser->supports(new \SplFileInfo('foo.php'))); | ||
static::assertTrue($this->parser->supports(new \SplFileInfo('FOO.PHP'))); | ||
static::assertFalse($this->parser->supports(new \SplFileInfo('FOO.html'))); | ||
static::assertFalse($this->parser->supports(new \stdClass())); | ||
} | ||
|
||
public function testParseWithInvalidData(): void | ||
{ | ||
$this->expectException(\LogicException::class); | ||
$this->expectExceptionMessage('data not supported'); | ||
$this->parser->parse(new \stdClass()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\SensioLabs\Deptrac\Subscriber; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use SensioLabs\Deptrac\AstRunner\AstParser\AstFileReferenceFileCache; | ||
use SensioLabs\Deptrac\AstRunner\Event\PostCreateAstMapEvent; | ||
use SensioLabs\Deptrac\AstRunner\Event\PreCreateAstMapEvent; | ||
use SensioLabs\Deptrac\Subscriber\CacheableFileSubscriber; | ||
|
||
class CacheableFileSubscriberTest extends TestCase | ||
{ | ||
public function testSubscribedEvents(): void | ||
{ | ||
static::assertSame( | ||
[ | ||
PreCreateAstMapEvent::class => 'onPreCreateAstMapEvent', | ||
PostCreateAstMapEvent::class => 'onPostCreateAstMapEvent', | ||
], | ||
CacheableFileSubscriber::getSubscribedEvents() | ||
); | ||
} | ||
|
||
public function testOnPreCreateAstMapEvent(): void | ||
{ | ||
$cache = $this->createMock(AstFileReferenceFileCache::class); | ||
$cache->expects(static::once())->method('load'); | ||
|
||
(new CacheableFileSubscriber($cache))->onPreCreateAstMapEvent(new PreCreateAstMapEvent(1)); | ||
} | ||
|
||
public function testOnPostCreateAstMapEvent(): void | ||
{ | ||
$cache = $this->createMock(AstFileReferenceFileCache::class); | ||
$cache->expects(static::once())->method('write'); | ||
|
||
(new CacheableFileSubscriber($cache))->onPostCreateAstMapEvent(new PostCreateAstMapEvent()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters