BabyStepsTest::testHelloWorldExercise()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 9.584
c 0
b 0
f 0
cc 3
nc 2
nop 0
1
<?php
2
3
4
namespace PhpSchool\LearnYouPhpTest\Exercise;
5
6
use PhpSchool\PhpWorkshop\Exercise\ExerciseType;
7
use PhpSchool\PhpWorkshop\Solution\SolutionInterface;
8
use PHPUnit\Framework\TestCase;
9
use PhpSchool\LearnYouPhp\Exercise\BabySteps;
10
11
/**
12
 * @author Aydin Hassan <[email protected]>
13
 */
14
class BabyStepsTest extends TestCase
15
{
16
    public function testHelloWorldExercise()
17
    {
18
        $e = new BabySteps;
19
        $this->assertEquals('Baby Steps', $e->getName());
20
        $this->assertEquals('Simple Addition', $e->getDescription());
21
        $this->assertEquals(ExerciseType::CLI, $e->getType());
22
23
        //sometime we don't get any args as number of args is random
24
        //we need some args for code-coverage, so just try again
25
        do {
26
            $args = $e->getArgs();
27
        } while (empty($args));
28
29
        foreach ($args as $arg) {
30
            $this->assertInternalType('int', $arg);
31
        }
32
33
        $this->assertInstanceOf(SolutionInterface::class, $e->getSolution());
34
        $this->assertFileExists(realpath($e->getProblem()));
35
        $this->assertNull($e->tearDown());
36
    }
37
}
38