diff --git a/src/Phpml/Exception/NormalizerException.php b/src/Phpml/Exception/NormalizerException.php index d1b689a..9f88f0c 100644 --- a/src/Phpml/Exception/NormalizerException.php +++ b/src/Phpml/Exception/NormalizerException.php @@ -13,5 +13,4 @@ class NormalizerException extends \Exception { return new self('Unknown norm supplied.'); } - } diff --git a/tests/Phpml/Clustering/KMeansTest.php b/tests/Phpml/Clustering/KMeansTest.php index 5a85b38..79b5ce7 100644 --- a/tests/Phpml/Clustering/KMeansTest.php +++ b/tests/Phpml/Clustering/KMeansTest.php @@ -48,4 +48,12 @@ class KMeansTest extends \PHPUnit_Framework_TestCase $clusters = $kmeans->cluster($samples); $this->assertEquals(4, count($clusters)); } + + /** + * @expectedException \Phpml\Exception\InvalidArgumentException + */ + public function testThrowExceptionOnInvalidClusterNumber() + { + new KMeans(0); + } }