Skip to content

Commit

Permalink
Issue #2 五倍數列初始版本
Browse files Browse the repository at this point in the history
  • Loading branch information
mouson committed Jan 9, 2017
1 parent c8dbf59 commit f4aa104
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/Helpers/SequenceCalculator/QuintupleSequenceCalculator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php
/**
* 五倍回傳計算數列
*/

namespace Mouson\Helpers\SequenceCalculator;

class QuintupleSequenceCalculator implements CalculatorInterface
{

/**
* @param $value
*
* @return int|mixed
*/
public function calculate($value)
{
return ($value * 5);
}

public function getSequenceName()
{
return 'Quintuple';
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
namespace Mouson\Helpers\SequenceCalculator;

class QuintupleSequenceCalculatorTest extends \PHPUnit_Framework_TestCase
{
public function test_物件產生後應可以取得物件名稱()
{
/** Arrange */
$target = new QuintupleSequenceCalculator();

/** Assume */
$expected = 'Quintuple';

/** Act */
$actual = $target->getSequenceName();

/** Assert */
$this->assertEquals($expected, $actual);
}

}

0 comments on commit f4aa104

Please sign in to comment.