Skip to content

Commit 0570b7b

Browse files
caoglishblakeembrey
authored andcommitted
Add PHPUnit test suite (blakeembrey#176)
1 parent f046083 commit 0570b7b

File tree

4 files changed

+29
-0
lines changed

4 files changed

+29
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
.idea
33
node_modules
44
*.o
5+
vendor

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"require": {
3+
"phpunit/phpunit": "5.5.*"
4+
}
5+
}

phpunit.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<testsuites >
3+
<testsuite name="code-problom test suites">
4+
<directory suffix="Test.php">tests/php</directory>
5+
</testsuite>
6+
</testsuites>

tests/php/factorialTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
use PHPUnit\Framework\TestCase;
3+
4+
require_once 'solutions/php/factorial.php';
5+
6+
class StackTest extends TestCase
7+
{
8+
public function test_factorial()
9+
{
10+
$this->assertEquals(1,factorial(1) );
11+
$this->assertEquals(2,factorial(2) );
12+
$this->assertEquals(6,factorial(3) );
13+
$this->assertEquals(120,factorial(5) );
14+
$this->assertEquals(2432902008176640000,factorial(20) );
15+
}
16+
}
17+
?>

0 commit comments

Comments
 (0)