Skip to content
This repository was archived by the owner on Nov 13, 2018. It is now read-only.

Commit 8a398d1

Browse files
committed
Updated repo
1 parent 759e78a commit 8a398d1

File tree

6 files changed

+18
-10
lines changed

6 files changed

+18
-10
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# https://github.com/github/gitignore
2-
# https://www.gitignore.io/
32
# http://git-scm.com/docs/gitignore
43

54
# phpstorm, webstorm

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ git:
1616
php:
1717
- 5.6
1818
- 7.0
19-
- hhvm
19+
2020

2121
matrix:
2222
fast_finish: true
2323
allow_failures:
2424
- php: 7.0
25-
- php: hhvm
25+
2626

2727
# We don't want to run linux commands as super user
2828
sudo: false

app/Classes/Calculator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Ankur;
3+
namespace Projects\Ankur;
44

55
class Calculator
66
{
@@ -43,13 +43,13 @@ public function subtractTwo($x, $y)
4343

4444
/**
4545
* Divide two numbers
46+
* //TODO Handle divide by zero
4647
* @param $x
4748
* @param $y
4849
* @return float
4950
*/
5051
public function divideTwo($x, $y)
5152
{
52-
//TODO Handle divide by zero
5353
return $x / $y;
5454
}
5555

public/index.php

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

33
require('../vendor/autoload.php');
44

5-
use Ankur\Calculator;
5+
use Projects\Ankur\Calculator;
66

77
$obj = new Calculator();
88

9-
echo $obj->addTwo(2,3);
9+
echo $obj->addTwo(2, 3);
1010
echo "<br>";
11-
echo $obj->multiplyTwo(2,3);
11+
echo $obj->multiplyTwo(2, 3);
1212

1313
?>
1414
This is just a sample page.

readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111
* [php-coveralls](https://github.com/satooshi/php-coveralls) v1.0.1
1212
* php Xdebug extension
1313

14+
### Test on localhost
15+
```
16+
cd path/to/this-project
17+
phpunit
18+
```
19+
1420
#### Reference Links
1521
* https://docs.travis-ci.com/
1622
* https://github.com/satooshi/php-coveralls

tests/CalculatorTest.php

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

33
namespace Tests;
44

5-
namespace Ankur;
5+
use Projects\Ankur as App;
66

77

88
class CalculatorTest extends \PHPUnit_Framework_TestCase
@@ -11,25 +11,28 @@ class CalculatorTest extends \PHPUnit_Framework_TestCase
1111

1212
private function getInstance()
1313
{
14-
return new Calculator();
14+
return new App\Calculator();
1515
}
1616

1717
public function testAdd()
1818
{
19+
fwrite(STDOUT, __METHOD__ . "\n");
1920
$obj = $this->getInstance();
2021
$value = $obj->addTwo(2, 3);
2122
$this->assertEquals($value, 5);
2223
}
2324

2425
public function testMultiply()
2526
{
27+
fwrite(STDOUT, __METHOD__ . "\n");
2628
$obj = $this->getInstance();
2729
$value = $obj->multiplyTwo(2, 3);
2830
$this->assertEquals($value, 6);
2931
}
3032

3133
public function testSubtract()
3234
{
35+
fwrite(STDOUT, __METHOD__ . "\n");
3336
$obj = $this->getInstance();
3437
$value = $obj->subtractTwo(4, 2);
3538
$this->assertEquals($value, 2);

0 commit comments

Comments
 (0)