Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Commit 088e90f

Browse files
committed
Code style
1 parent 9ef7023 commit 088e90f

File tree

5 files changed

+40
-48
lines changed

5 files changed

+40
-48
lines changed

src/Manager.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ public function accept()
263263
{
264264
$current = $this->current()->getPathname();
265265

266-
if(".".DIRECTORY_SEPARATOR !== $current[0].$current[1]) {
267-
$current = ".".DIRECTORY_SEPARATOR.$current;
266+
if ('.' . DIRECTORY_SEPARATOR !== $current[0] . $current[1]) {
267+
$current = '.' . DIRECTORY_SEPARATOR . $current;
268268
}
269269

270270
return !in_array($current, $this->excluded);
@@ -295,15 +295,15 @@ public function getChildren()
295295
}
296296

297297
/**
298-
* @param string $excluded
298+
* @param string $file
299299
* @return string
300300
*/
301301
private function getPathname($file)
302302
{
303-
if(".".DIRECTORY_SEPARATOR !== $file[0].$file[1]) {
304-
$file = ".".DIRECTORY_SEPARATOR.$file;
303+
if ('.' . DIRECTORY_SEPARATOR !== $file[0] . $file[1]) {
304+
$file = '.' . DIRECTORY_SEPARATOR . $file;
305305
}
306-
306+
307307
$directoryFile = new \SplFileInfo($file);
308308
return $directoryFile->getPathname();
309309
}

tests/Manager.run.phpt

Lines changed: 30 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ require_once __DIR__ . '/../src/Settings.php';
99
require_once __DIR__ . '/../src/exceptions.php';
1010

1111
use JakubOnderka\PhpParallelLint\Manager;
12+
use JakubOnderka\PhpParallelLint\NullWriter;
13+
use JakubOnderka\PhpParallelLint\Output;
1214
use JakubOnderka\PhpParallelLint\Settings;
1315
use Tester\Assert;
1416

@@ -24,8 +26,6 @@ class ManagerRunTest extends Tester\TestCase
2426
}, 'JakubOnderka\PhpParallelLint\NotExistsPathException');
2527
}
2628

27-
28-
2929
public function testFilesNotFound()
3030
{
3131
$settings = $this->prepareSettings();
@@ -36,76 +36,71 @@ class ManagerRunTest extends Tester\TestCase
3636
}, 'JakubOnderka\PhpParallelLint\Exception', 'No file found to check.');
3737
}
3838

39-
40-
4139
public function testSuccess()
4240
{
4341
$settings = $this->prepareSettings();
4442
$settings->paths = array('examples/example-02/');
45-
$manager = new Manager($settings);
46-
ob_start();
47-
$code = $manager->run($settings);
48-
ob_clean();
43+
44+
$manager = $this->getManager($settings);
45+
$code = $manager->run($settings);
4946
Assert::true($code);
5047
}
5148

52-
53-
5449
public function testError()
5550
{
5651
$settings = $this->prepareSettings();
5752
$settings->paths = array('examples/example-03/');
58-
$manager = new Manager($settings);
59-
ob_start();
60-
$code = $manager->run($settings);
61-
ob_clean();
53+
54+
$manager = $this->getManager($settings);
55+
$code = $manager->run($settings);
6256
Assert::false($code);
6357
}
6458

65-
66-
6759
public function testExcludeRelativeSubdirectory()
6860
{
6961
$settings = $this->prepareSettings();
7062
$settings->paths = array('examples/example-04/');
7163

72-
$manager = new Manager($settings);
73-
ob_start();
74-
$code = $manager->run($settings);
75-
ob_clean();
64+
$manager = $this->getManager($settings);
65+
$code = $manager->run($settings);
7666
Assert::false($code);
7767

7868
$settings->excluded = array('examples/example-04/dir1/dir2');
7969

80-
$manager = new Manager($settings);
81-
ob_start();
82-
$code = $manager->run($settings);
83-
ob_clean();
70+
$manager = $this->getManager($settings);
71+
$code = $manager->run($settings);
8472
Assert::true($code);
8573
}
8674

87-
function testExcludeAbsoluteSubdirectory()
75+
public function testExcludeAbsoluteSubdirectory()
8876
{
8977
$settings = $this->prepareSettings();
9078
$cwd = getcwd();
91-
$settings->paths = array($cwd."/examples/example-04/");
79+
$settings->paths = array($cwd . '/examples/example-04/');
9280
$settings->excluded = array();
9381

94-
$manager = new Manager($settings);
95-
ob_start();
96-
$code = $manager->run($settings);
97-
ob_clean();
82+
$manager = $this->getManager($settings);
83+
$code = $manager->run($settings);
9884
Assert::false($code);
9985

86+
$settings->excluded = array($cwd . '/examples/example-04/dir1/dir2');
10087

101-
$settings->excluded = array($cwd.'/examples/example-04/dir1/dir2');
102-
$manager = new Manager($settings);
103-
ob_start();
104-
$code = $manager->run($settings);
105-
ob_clean();
88+
$manager = $this->getManager($settings);
89+
$code = $manager->run($settings);
10690
Assert::true($code);
10791
}
10892

93+
/**
94+
* @param Settings $settings
95+
* @return Manager
96+
*/
97+
private function getManager(Settings $settings)
98+
{
99+
$manager = new Manager($settings);
100+
$manager->setOutput(new Output(new NullWriter()));
101+
return $manager;
102+
}
103+
109104
/**
110105
* @return JakubOnderka\PhpParallelLint\Settings
111106
*/
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
<?php
2-
$foo ='bar'
3-
echo $foo;
4-
?>
2+
$foo ='bar'
3+
echo $foo;
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
<?php
2-
$foo = 'bar';
3-
?>
2+
$foo = 'bar';
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
<?php
2-
$foo = 'bar';
3-
?>
2+
$foo = 'bar';

0 commit comments

Comments
 (0)