@@ 17-52 (lines=36) @@ | ||
14 | * Class DivideItTest |
|
15 | * @package PhpSchool\Php7WayTest\Exercise |
|
16 | */ |
|
17 | class DivideItTest extends PHPUnit_Framework_TestCase |
|
18 | { |
|
19 | public function testDivideItExercice() |
|
20 | { |
|
21 | $e = new DivideIt(); |
|
22 | $this->assertEquals('Divide it', $e->getName()); |
|
23 | $this->assertEquals('Divide a number by another', $e->getDescription()); |
|
24 | $this->assertEquals(ExerciseType::CLI, $e->getType()); |
|
25 | ||
26 | $this->assertEquals([4, 3], $e->getArgs()); |
|
27 | ||
28 | $this->assertInstanceOf(SolutionInterface::class, $e->getSolution()); |
|
29 | $this->assertFileExists(realpath($e->getProblem())); |
|
30 | $this->assertNull($e->tearDown()); |
|
31 | } |
|
32 | ||
33 | public function testFunctionRequirements() |
|
34 | { |
|
35 | $e = new DivideIt(); |
|
36 | $this->assertEquals(['intdiv'], $e->getRequiredFunctions()); |
|
37 | $this->assertEquals([], $e->getBannedFunctions()); |
|
38 | } |
|
39 | ||
40 | public function testConfigure() |
|
41 | { |
|
42 | $dispatcher = $this->getMockBuilder(ExerciseDispatcher::class) |
|
43 | ->disableOriginalConstructor() |
|
44 | ->getMock(); |
|
45 | $dispatcher |
|
46 | ->expects($this->once()) |
|
47 | ->method('requireCheck') |
|
48 | ->with(FunctionRequirementsCheck::class); |
|
49 | $e = new DivideIt(); |
|
50 | $e->configure($dispatcher); |
|
51 | } |
|
52 | } |
|
53 |
@@ 17-51 (lines=35) @@ | ||
14 | * Class NewGenerationTransferTest |
|
15 | * @package PhpSchool\Php7WayTest\Exercise |
|
16 | */ |
|
17 | class NewGenerationTransferTest extends PHPUnit_Framework_TestCase |
|
18 | { |
|
19 | public function testNewGenerationTransferExercise() |
|
20 | { |
|
21 | $e = new NewGenerationTransfer(); |
|
22 | $this->assertEquals('The new generation transfers its power', $e->getName()); |
|
23 | $this->assertEquals('Use generators delegating some parts of the algorithm', $e->getDescription()); |
|
24 | $this->assertEquals(ExerciseType::CLI, $e->getType()); |
|
25 | ||
26 | $this->assertEquals(["firstArgument", "secondArgument", "thirdArgument"], $e->getArgs()); |
|
27 | ||
28 | $this->assertInstanceOf(SolutionInterface::class, $e->getSolution()); |
|
29 | $this->assertFileExists(realpath($e->getProblem())); |
|
30 | $this->assertNull($e->tearDown()); |
|
31 | } |
|
32 | ||
33 | public function testFunctionRequirements() |
|
34 | { |
|
35 | $e = new NewGenerationTransfer(); |
|
36 | $this->assertEquals(['strtoupper'], $e->getRequiredFunctions()); |
|
37 | $this->assertEquals([], $e->getBannedFunctions()); |
|
38 | } |
|
39 | public function testConfigure() |
|
40 | { |
|
41 | $dispatcher = $this->getMockBuilder(ExerciseDispatcher::class) |
|
42 | ->disableOriginalConstructor() |
|
43 | ->getMock(); |
|
44 | $dispatcher |
|
45 | ->expects($this->once()) |
|
46 | ->method('requireCheck') |
|
47 | ->with(FunctionRequirementsCheck::class); |
|
48 | $e = new NewGenerationTransfer(); |
|
49 | $e->configure($dispatcher); |
|
50 | } |
|
51 | } |
|
52 |
@@ 17-51 (lines=35) @@ | ||
14 | * Class NewGenerationTest |
|
15 | * @package PhpSchool\Php7WayTest\Exercise |
|
16 | */ |
|
17 | class NewGenerationTest extends PHPUnit_Framework_TestCase |
|
18 | { |
|
19 | public function testNewGenerationExercise() |
|
20 | { |
|
21 | $e = new NewGeneration(); |
|
22 | $this->assertEquals('A new generation is coming', $e->getName()); |
|
23 | $this->assertEquals('Develop a generator and use it', $e->getDescription()); |
|
24 | $this->assertEquals(ExerciseType::CLI, $e->getType()); |
|
25 | ||
26 | $this->assertEquals(["firstArgument", "secondArgument", "thirdArgument"], $e->getArgs()); |
|
27 | ||
28 | $this->assertInstanceOf(SolutionInterface::class, $e->getSolution()); |
|
29 | $this->assertFileExists(realpath($e->getProblem())); |
|
30 | $this->assertNull($e->tearDown()); |
|
31 | } |
|
32 | ||
33 | public function testFunctionRequirements() |
|
34 | { |
|
35 | $e = new NewGeneration(); |
|
36 | $this->assertEquals(['strtoupper'], $e->getRequiredFunctions()); |
|
37 | $this->assertEquals([], $e->getBannedFunctions()); |
|
38 | } |
|
39 | public function testConfigure() |
|
40 | { |
|
41 | $dispatcher = $this->getMockBuilder(ExerciseDispatcher::class) |
|
42 | ->disableOriginalConstructor() |
|
43 | ->getMock(); |
|
44 | $dispatcher |
|
45 | ->expects($this->once()) |
|
46 | ->method('requireCheck') |
|
47 | ->with(FunctionRequirementsCheck::class); |
|
48 | $e = new NewGeneration(); |
|
49 | $e->configure($dispatcher); |
|
50 | } |
|
51 | } |
|
52 |
@@ 17-52 (lines=36) @@ | ||
14 | * Class TypeYourOutputTest |
|
15 | * @package PhpSchool\Php7WayTest\Exercise |
|
16 | */ |
|
17 | class TypeYourOutputTest extends PHPUnit_Framework_TestCase |
|
18 | { |
|
19 | public function testTypeYourOutputExercise() |
|
20 | { |
|
21 | $e = new TypeYourOutput(); |
|
22 | $this->assertEquals('Type your output!', $e->getName()); |
|
23 | $this->assertEquals('Use types to validate the output of a function', $e->getDescription()); |
|
24 | $this->assertEquals(ExerciseType::CLI, $e->getType()); |
|
25 | ||
26 | $this->assertEquals([1, 2], $e->getArgs()); |
|
27 | ||
28 | $this->assertInstanceOf(SolutionInterface::class, $e->getSolution()); |
|
29 | $this->assertFileExists(realpath($e->getProblem())); |
|
30 | $this->assertNull($e->tearDown()); |
|
31 | } |
|
32 | ||
33 | public function testFunctionRequirements() |
|
34 | { |
|
35 | $e = new TypeYourOutput(); |
|
36 | $this->assertEquals(['noStrictFunction', 'strictFunction'], $e->getRequiredFunctions()); |
|
37 | $this->assertEquals([], $e->getBannedFunctions()); |
|
38 | } |
|
39 | ||
40 | public function testConfigure() |
|
41 | { |
|
42 | $dispatcher = $this->getMockBuilder(ExerciseDispatcher::class) |
|
43 | ->disableOriginalConstructor() |
|
44 | ->getMock(); |
|
45 | $dispatcher |
|
46 | ->expects($this->once()) |
|
47 | ->method('requireCheck') |
|
48 | ->with(FunctionRequirementsCheck::class); |
|
49 | $e = new TypeYourOutput(); |
|
50 | $e->configure($dispatcher); |
|
51 | } |
|
52 | } |
|
53 |
@@ 17-51 (lines=35) @@ | ||
14 | * Class TypeYourArgumentsTest |
|
15 | * @package PhpSchool\Php7WayTest\Exercise |
|
16 | */ |
|
17 | class TypeYourArgumentsTest extends PHPUnit_Framework_TestCase |
|
18 | { |
|
19 | public function testTypeYourArgumentsExercise() |
|
20 | { |
|
21 | $e = new TypeYourArguments(); |
|
22 | $this->assertEquals('Type your arguments!', $e->getName()); |
|
23 | $this->assertEquals('Use scalar types with arguments', $e->getDescription()); |
|
24 | $this->assertEquals(ExerciseType::CLI, $e->getType()); |
|
25 | ||
26 | $this->assertEquals([], $e->getArgs()); |
|
27 | ||
28 | $this->assertInstanceOf(SolutionInterface::class, $e->getSolution()); |
|
29 | $this->assertFileExists(realpath($e->getProblem())); |
|
30 | $this->assertNull($e->tearDown()); |
|
31 | } |
|
32 | ||
33 | public function testFunctionRequirements() |
|
34 | { |
|
35 | $e = new TypeYourArguments(); |
|
36 | $this->assertEquals(['noStrictFunction', 'strictFunction'], $e->getRequiredFunctions()); |
|
37 | $this->assertEquals([], $e->getBannedFunctions()); |
|
38 | } |
|
39 | public function testConfigure() |
|
40 | { |
|
41 | $dispatcher = $this->getMockBuilder(ExerciseDispatcher::class) |
|
42 | ->disableOriginalConstructor() |
|
43 | ->getMock(); |
|
44 | $dispatcher |
|
45 | ->expects($this->once()) |
|
46 | ->method('requireCheck') |
|
47 | ->with(FunctionRequirementsCheck::class); |
|
48 | $e = new TypeYourArguments(); |
|
49 | $e->configure($dispatcher); |
|
50 | } |
|
51 | } |
|
52 |