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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:

-
name: "Run friendsofphp/php-cs-fixer"
run: "vendor/bin/php-cs-fixer fix --dry-run --diff --verbose"
run: "vendor/bin/php-cs-fixer fix --dry-run --diff --verbose --allow-risky=yes"
phpstan:
name: "PHPStan (${{ matrix.php-version }})"

Expand Down
7 changes: 6 additions & 1 deletion .php_cs.dist
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ $finder = PhpCsFixer\Finder::create()
->in('lib')
->in('tests')
->exclude([
'tests/Workspace'
'tests/Workspace',
])
;

Expand All @@ -13,6 +13,11 @@ return PhpCsFixer\Config::create()
'@PSR2' => true,
'no_unused_imports' => true,
'array_syntax' => ['syntax' => 'short'],
'void_return' => true,
'ordered_class_elements' => true,
'single_quote' => true,
'heredoc_indentation' => true,
'global_namespace_import' => true,
])
->setFinder($finder)
;
Expand Down
50 changes: 25 additions & 25 deletions tests/Integration/WorkspaceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ protected function setUp(): void
$this->workspace->reset();
}

public function testBuild()
public function testBuild(): void
{
$manifest = <<<'EOT'
// File: Foobar.php
<?php

class Foobar
{
}
// File: Foobar/Barfoo.php
<?php

namespace Foobar;

class Barfoo
{
}
// File: Expected.php
Hello World
EOT
// File: Foobar.php
<?php

class Foobar
{
}
// File: Foobar/Barfoo.php
<?php

namespace Foobar;

class Barfoo
{
}
// File: Expected.php
Hello World
EOT
;

$this->workspace->loadManifest($manifest);
Expand All @@ -43,15 +43,15 @@ class Barfoo
$this->assertEquals('Hello World', $this->workspace->getContents('Expected.php'));
}

public function testGetContentsNotExist()
public function testGetContentsNotExist(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('File "barbarbarbar" does not exist');

$this->workspace->getContents('barbarbarbar');
}

public function testReset()
public function testReset(): void
{
$this->workspace->reset();
touch($this->workspace->path('Foobar.php'));
Expand All @@ -67,31 +67,31 @@ public function testReset()
$this->assertFalse($this->workspace->exists('Barfoo/Bazboo.php'));
}

public function testMkdir()
public function testMkdir(): void
{
$this->workspace->mkdir('foobar');
$this->assertTrue($this->workspace->exists('foobar'));
$this->assertFalse($this->workspace->exists('barfoo'));
}

public function testPutFileContents()
public function testPutFileContents(): void
{
$this->workspace->put('foobar', 'foobar contents');
$this->assertTrue($this->workspace->exists('foobar'));
$this->assertStringContainsString('foobar contents', $this->workspace->getContents('foobar'));
}

public function testGetPathWithNoArgs()
public function testGetPathWithNoArgs(): void
{
$this->assertEquals($this->workspaceDir(), $this->workspace->path());
}

public function testGetPath()
public function testGetPath(): void
{
$this->assertEquals($this->workspaceDir() . '/foo', $this->workspace->path('foo'));
}

public function testGetPathConcat()
public function testGetPathConcat(): void
{
$workspace = Workspace::create($this->workspaceDir() . '/foobar/');
$this->assertEquals($this->workspaceDir() . '/foobar/foo', $workspace->path('foo'));
Expand Down