From 9cada1311cafd61427d368ecb086cc35c0df34a1 Mon Sep 17 00:00:00 2001 From: KidA78 Date: Thu, 21 Jul 2016 12:48:59 -0700 Subject: [PATCH 1/3] #35 Removed validation for requiring keyword_matches flag to be true --- lib/TraackrApi/Posts.php | 5 ----- test/Posts/PostsTest.php | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/TraackrApi/Posts.php b/lib/TraackrApi/Posts.php index 0c06d60..8f7953e 100644 --- a/lib/TraackrApi/Posts.php +++ b/lib/TraackrApi/Posts.php @@ -71,11 +71,6 @@ public static function search($p = array( $p['include_brand_content'] = $posts->convertBool($p, 'include_brand_content'); $p['include_shared_content'] = $posts->convertBool($p, 'include_shared_content'); - // Validate business requirements - if ( $p['enable_keyword_aggregation'] === 'true' && $p['include_keyword_matches'] === 'false' ) { - throw new MissingParameterException("'include_keyword_matches' needs to be set to true for 'keyword_aggregation' to work"); - } - // support for multi params $p['keywords'] = is_array($p['keywords']) ? implode(',', $p['keywords']) : $p['keywords']; diff --git a/test/Posts/PostsTest.php b/test/Posts/PostsTest.php index b6be6e5..9e08518 100644 --- a/test/Posts/PostsTest.php +++ b/test/Posts/PostsTest.php @@ -43,11 +43,12 @@ public function testLookup() { * @expectedException Traackr\MissingParameterException */ public function testSearchInvalidParameter() { - Traackr\Posts::search(array( + $posts = Traackr\Posts::search(array( 'keywords' => array('traackr', '"content marketing"'), 'include_keyword_matches' => false, 'enable_keyword_aggregation' => true )); + $this->assertGreaterThan(0, $posts['posts'], 'No results found'); } /** From 4aa69dd6b0885c7ef77e51d6621dc69c1dba5573 Mon Sep 17 00:00:00 2001 From: KidA78 Date: Thu, 21 Jul 2016 12:57:18 -0700 Subject: [PATCH 2/3] #35 remove exception annotation, and updated test name --- test/Posts/PostsTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Posts/PostsTest.php b/test/Posts/PostsTest.php index 9e08518..52e06d6 100644 --- a/test/Posts/PostsTest.php +++ b/test/Posts/PostsTest.php @@ -38,11 +38,11 @@ public function testLookup() { } // End function testLookup() /** - * If keyword_aggregation is enable, keyword_matches must be set to true + * Having a false keyword match param, should still return + * valid results, even with keyword aggregation turned on * @group read only - * @expectedException Traackr\MissingParameterException */ - public function testSearchInvalidParameter() { + public function testSearchWithFalseKwMatchParam() { $posts = Traackr\Posts::search(array( 'keywords' => array('traackr', '"content marketing"'), 'include_keyword_matches' => false, From 8db288e3f75e2d5e37786ccb34cd482eb86e9000 Mon Sep 17 00:00:00 2001 From: KidA78 Date: Thu, 21 Jul 2016 13:22:40 -0700 Subject: [PATCH 3/3] #35 rename unit test --- test/Posts/PostsTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Posts/PostsTest.php b/test/Posts/PostsTest.php index 52e06d6..81ee6a6 100644 --- a/test/Posts/PostsTest.php +++ b/test/Posts/PostsTest.php @@ -42,7 +42,7 @@ public function testLookup() { * valid results, even with keyword aggregation turned on * @group read only */ - public function testSearchWithFalseKwMatchParam() { + public function testSearchWithKeywordAggregations() { $posts = Traackr\Posts::search(array( 'keywords' => array('traackr', '"content marketing"'), 'include_keyword_matches' => false,