Skip to content

Commit 2f4a2aa

Browse files
committed
Rename custom runner
1 parent 8549c21 commit 2f4a2aa

File tree

8 files changed

+31
-38
lines changed

8 files changed

+31
-38
lines changed

src/Exercise/CustomExercise.php renamed to src/Exercise/CustomVerifyingExercise.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* @author Aydin Hassan <[email protected]>
99
*/
10-
interface CustomExercise
10+
interface CustomVerifyingExercise
1111
{
1212
/**
1313
* @return ResultInterface

src/Exercise/ExerciseType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ExerciseType extends Enum
3232
private static $exerciseTypeToExerciseInterfaceMap = [
3333
self::CLI => CliExercise::class,
3434
self::CGI => CgiExercise::class,
35-
self::CUSTOM => CustomExercise::class,
35+
self::CUSTOM => CustomVerifyingExercise::class,
3636
];
3737

3838
/**

src/ExerciseRunner/CustomRunner.php renamed to src/ExerciseRunner/CustomVerifyingRunner.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
namespace PhpSchool\PhpWorkshop\ExerciseRunner;
44

5-
use PhpSchool\PhpWorkshop\Exercise\CustomExercise;
5+
use PhpSchool\PhpWorkshop\Exercise\CustomVerifyingExercise;
66
use PhpSchool\PhpWorkshop\Input\Input;
77
use PhpSchool\PhpWorkshop\Output\OutputInterface;
88
use PhpSchool\PhpWorkshop\Result\ResultInterface;
99

1010
/**
1111
* @author Aydin Hassan <[email protected]>
1212
*/
13-
class CustomRunner implements ExerciseRunnerInterface
13+
class CustomVerifyingRunner implements ExerciseRunnerInterface
1414
{
1515
/**
16-
* @var CustomExercise
16+
* @var CustomVerifyingExercise
1717
*/
1818
private $exercise;
1919

2020
/**
21-
* @param CustomExercise $exercise
21+
* @param CustomVerifyingExercise $exercise
2222
*/
23-
public function __construct(CustomExercise $exercise)
23+
public function __construct(CustomVerifyingExercise $exercise)
2424
{
2525
$this->exercise = $exercise;
2626
}
@@ -32,7 +32,7 @@ public function __construct(CustomExercise $exercise)
3232
*/
3333
public function getName()
3434
{
35-
return 'External Runner';
35+
return 'Custom Verifying Runner';
3636
}
3737

3838
/**

src/ExerciseRunner/Factory/CustomRunnerFactory.php renamed to src/ExerciseRunner/Factory/CustomVerifyingRunnerFactory.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,16 @@
22

33
namespace PhpSchool\PhpWorkshop\ExerciseRunner\Factory;
44

5-
use PhpSchool\PhpWorkshop\CommandArgument;
65
use PhpSchool\PhpWorkshop\CommandDefinition;
7-
use PhpSchool\PhpWorkshop\Event\EventDispatcher;
86
use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface;
97
use PhpSchool\PhpWorkshop\Exercise\ExerciseType;
10-
use PhpSchool\PhpWorkshop\ExerciseRunner\CgiRunner;
11-
use PhpSchool\PhpWorkshop\ExerciseRunner\CustomRunner;
8+
use PhpSchool\PhpWorkshop\ExerciseRunner\CustomVerifyingRunner;
129
use PhpSchool\PhpWorkshop\ExerciseRunner\ExerciseRunnerInterface;
1310

1411
/**
1512
* @author Aydin Hassan <[email protected]>
1613
*/
17-
class CustomRunnerFactory implements ExerciseRunnerFactoryInterface
14+
class CustomVerifyingRunnerFactory implements ExerciseRunnerFactoryInterface
1815
{
1916
/**
2017
* @var string
@@ -49,6 +46,6 @@ public function configureInput(CommandDefinition $commandDefinition)
4946
*/
5047
public function create(ExerciseInterface $exercise)
5148
{
52-
return new CustomRunner($exercise);
49+
return new CustomVerifyingRunner($exercise);
5350
}
5451
}

test/Asset/ExtExerciseImpl.php renamed to test/Asset/CustomVerifyingExerciseImpl.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
use PhpSchool\PhpWorkshop\Exercise\AbstractExercise;
66
use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface;
77
use PhpSchool\PhpWorkshop\Exercise\ExerciseType;
8-
use PhpSchool\PhpWorkshop\Exercise\CustomExercise;
8+
use PhpSchool\PhpWorkshop\Exercise\CustomVerifyingExercise;
99
use PhpSchool\PhpWorkshop\Result\ResultInterface;
1010
use PhpSchool\PhpWorkshop\Result\Success;
1111

1212
/**
1313
* @author Aydin Hassan <[email protected]>
1414
*/
15-
class ExtExerciseImpl extends AbstractExercise implements ExerciseInterface, CustomExercise
15+
class CustomVerifyingExerciseImpl extends AbstractExercise implements ExerciseInterface, CustomVerifyingExercise
1616
{
1717

1818
/**
@@ -22,7 +22,7 @@ class ExtExerciseImpl extends AbstractExercise implements ExerciseInterface, Cus
2222
*/
2323
public function getName()
2424
{
25-
return 'EXT exercise';
25+
return 'Custom Verifying exercise';
2626
}
2727

2828
/**
@@ -32,7 +32,7 @@ public function getName()
3232
*/
3333
public function getDescription()
3434
{
35-
return 'EXT exercise';
35+
return 'Custom Verifying exercise';
3636
}
3737

3838
/**
@@ -42,7 +42,7 @@ public function getDescription()
4242
*/
4343
public function getType()
4444
{
45-
return ExerciseType::EXT();
45+
return ExerciseType::CUSTOM();
4646
}
4747

4848
/**

test/ExerciseRunner/CustomRunnerTest.php renamed to test/ExerciseRunner/CustomVerifyingRunnerTest.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44

55
use Colors\Color;
66
use PhpSchool\CliMenu\Terminal\TerminalInterface;
7-
use PhpSchool\PhpWorkshop\ExerciseDispatcher;
87
use PhpSchool\PhpWorkshop\Input\Input;
98
use PhpSchool\PhpWorkshop\Output\StdOutput;
10-
use PhpSchool\PhpWorkshopTest\Asset\ExtExerciseImpl;
9+
use PhpSchool\PhpWorkshopTest\Asset\CustomVerifyingExerciseImpl;
1110
use PHPUnit_Framework_TestCase;
1211

1312
/**
@@ -16,21 +15,21 @@
1615
class ExtRunnerTest extends PHPUnit_Framework_TestCase
1716
{
1817
/**
19-
* @var CustomRunner
18+
* @var CustomVerifyingRunner
2019
*/
2120
private $runner;
2221

2322
/**
24-
* @var ExtExerciseImpl
23+
* @var CustomVerifyingExerciseImpl
2524
*/
2625
private $exercise;
2726

2827
public function setUp()
2928
{
30-
$this->exercise = new ExtExerciseImpl;
31-
$this->runner = new CustomRunner($this->exercise);
29+
$this->exercise = new CustomVerifyingExerciseImpl;
30+
$this->runner = new CustomVerifyingRunner($this->exercise);
3231

33-
$this->assertEquals('External Runner', $this->runner->getName());
32+
$this->assertEquals('Custom Verifying Runner', $this->runner->getName());
3433
}
3534

3635
public function testRunOutputsErrorMessage()
@@ -39,7 +38,7 @@ public function testRunOutputsErrorMessage()
3938
$color->setForceStyle(true);
4039
$output = new StdOutput($color, $this->createMock(TerminalInterface::class));
4140

42-
$exp = "Nothing to run here. This exercise does not require a code solution, ";
41+
$exp = 'Nothing to run here. This exercise does not require a code solution, ';
4342
$exp .= "so there is nothing to execute.\n";
4443

4544
$this->expectOutputString($exp);

test/ExerciseRunner/Factory/CliRunnerFactoryTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,11 @@
44

55
use PhpSchool\PhpWorkshop\CommandDefinition;
66
use PhpSchool\PhpWorkshop\Event\EventDispatcher;
7-
use PhpSchool\PhpWorkshop\Exercise\CliExercise;
87
use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface;
98
use PhpSchool\PhpWorkshop\Exercise\ExerciseType;
109
use PhpSchool\PhpWorkshop\ExerciseRunner\CliRunner;
1110
use PhpSchool\PhpWorkshop\ExerciseRunner\Factory\CliRunnerFactory;
1211
use PhpSchool\PhpWorkshopTest\Asset\CliExerciseImpl;
13-
use PhpSchool\PhpWorkshopTest\Asset\CliExerciseInterface;
1412
use PHPUnit_Framework_TestCase;
1513

1614
/**

test/ExerciseRunner/Factory/CustomRunnerFactoryTest.php renamed to test/ExerciseRunner/Factory/CustomVerifyingRunnerFactoryTest.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
namespace PhpSchool\PhpWorkshopTest\ExerciseRunner\Factory;
44

55
use PhpSchool\PhpWorkshop\CommandDefinition;
6-
use PhpSchool\PhpWorkshop\Event\EventDispatcher;
7-
use PhpSchool\PhpWorkshop\Exercise\CustomExercise;
6+
use PhpSchool\PhpWorkshop\Exercise\CustomVerifyingExercise;
87
use PhpSchool\PhpWorkshop\Exercise\ExerciseInterface;
98
use PhpSchool\PhpWorkshop\Exercise\ExerciseType;
10-
use PhpSchool\PhpWorkshop\ExerciseRunner\CustomRunner;
11-
use PhpSchool\PhpWorkshop\ExerciseRunner\Factory\CustomRunnerFactory;
12-
use PhpSchool\PhpWorkshopTest\Asset\ExtExerciseImpl;
9+
use PhpSchool\PhpWorkshop\ExerciseRunner\CustomVerifyingRunner;
10+
use PhpSchool\PhpWorkshop\ExerciseRunner\Factory\CustomVerifyingRunnerFactory;
11+
use PhpSchool\PhpWorkshopTest\Asset\CustomVerifyingExerciseImpl;
1312
use PHPUnit_Framework_TestCase;
1413

1514
/**
@@ -18,13 +17,13 @@
1817
class CustomRunnerFactoryTest extends PHPUnit_Framework_TestCase
1918
{
2019
/**
21-
* @var CustomRunnerFactory
20+
* @var CustomVerifyingRunnerFactory
2221
*/
2322
private $factory;
2423

2524
public function setUp()
2625
{
27-
$this->factory = new CustomRunnerFactory;
26+
$this->factory = new CustomVerifyingRunnerFactory;
2827
}
2928

3029
public function testSupports()
@@ -52,7 +51,7 @@ public function testConfigureInputAddsNoArgument()
5251

5352
public function testCreateReturnsRunner()
5453
{
55-
$exercise = new ExtExerciseImpl;
56-
$this->assertInstanceOf(CustomRunner::class, $this->factory->create($exercise));
54+
$exercise = new CustomVerifyingExerciseImpl;
55+
$this->assertInstanceOf(CustomVerifyingRunner::class, $this->factory->create($exercise));
5756
}
5857
}

0 commit comments

Comments
 (0)