Skip to content

Commit 6044c4b

Browse files
committed
Tidy up the default TestCase class
1 parent bd01721 commit 6044c4b

File tree

1 file changed

+7
-24
lines changed

1 file changed

+7
-24
lines changed

tests/TestBase.php

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@
66
use League\CLImate\Util\Output;
77
use League\CLImate\Util\Reader\Stdin;
88
use League\CLImate\Util\System\Linux;
9+
use League\CLImate\Util\UtilFactory;
910
use Mockery;
1011
use PHPUnit\Framework\TestCase;
1112

12-
class TestBase extends TestCase
13+
abstract class TestBase extends TestCase
1314
{
1415
public static $functions;
1516

16-
/** @var League\CLImate\CLImate */
17+
/** @var CLImate */
1718
public $cli;
1819

19-
/** @var League\CLImate\Util\Output|Mockery\MockInterface */
20+
/** @var Output|Mockery\MockInterface */
2021
public $output;
2122

22-
/** @var League\CLImate\Util\Reader\Stdin|Mockery\MockInterface */
23+
/** @var Stdin|Mockery\MockInterface */
2324
public $reader;
2425

25-
/** @var League\CLImate\Util\UtilFactory */
26+
/** @var UtilFactory */
2627
public $util;
2728

28-
protected $record_it = false;
2929

3030
public function setUp(): void
3131
{
@@ -35,17 +35,13 @@ public function setUp(): void
3535
$system->shouldReceive('hasAnsiSupport')->andReturn(true);
3636
$system->shouldReceive('width')->andReturn(80);
3737

38-
$this->util = new \League\CLImate\Util\UtilFactory($system);
38+
$this->util = new UtilFactory($system);
3939
$this->output = Mockery::mock(Output::class);
4040
$this->reader = Mockery::mock(Stdin::class);
4141

4242
$this->cli = new CLImate();
4343
$this->cli->setOutput($this->output);
4444
$this->cli->setUtil($this->util);
45-
46-
if (method_exists($this, 'internalSetup')) {
47-
$this->internalSetup();
48-
}
4945
}
5046

5147
public function tearDown(): void
@@ -61,10 +57,6 @@ public function tearDown(): void
6157
*/
6258
protected function shouldWrite($content, $count = 1)
6359
{
64-
if ($this->record_it) {
65-
file_put_contents('test-log', $content, FILE_APPEND);
66-
}
67-
6860
return $this->output->shouldReceive('write')->times($count)->with($content);
6961
}
7062

@@ -121,13 +113,4 @@ protected function shouldStopPersisting($times = 1)
121113
{
122114
$this->output->shouldReceive('persist')->with(false)->times($times)->andReturn($this->output);
123115
}
124-
125-
/**
126-
* @test
127-
* @doesNotPerformAssertions
128-
*/
129-
public function it_does_nothing()
130-
{
131-
// nada
132-
}
133116
}

0 commit comments

Comments
 (0)