From 52e6bb6a011631f1cc95a5f3c7314aff5593cea5 Mon Sep 17 00:00:00 2001 From: Paul Rock Date: Thu, 23 Aug 2018 02:10:11 +0300 Subject: [PATCH] query test added --- tests/QueryTest.php | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 tests/QueryTest.php diff --git a/tests/QueryTest.php b/tests/QueryTest.php new file mode 100644 index 0000000..f7dda3b --- /dev/null +++ b/tests/QueryTest.php @@ -0,0 +1,56 @@ +assertInternalType('object', $obj); + } catch (\Exception $e) { + $this->assertContains('Must be initialized ', $e->getMessage()); + } + } + + public function testGetEndpoint() + { + $obj = new Query('test'); + $test = $obj->getEndpoint(); + $this->assertEquals($test, 'test'); + } + + public function testGetAttributes() + { + $obj = new Query('test'); + $test = $obj->getAttributes(); + $this->assertCount(0, $test); + } + + public function testAdd() + { + $obj = new Query('test'); + $obj->add('line'); + + $attrs = $obj->getAttributes(); + $this->assertCount(1, $attrs); + $this->assertEquals($attrs[0], 'line'); + } + + public function testGetQuery() + { + $obj = new Query('test'); + $obj->add('line'); + + $query = $obj->getQuery(); + $this->assertCount(2, $query); + $this->assertEquals($query[0], 'test'); + $this->assertEquals($query[1], 'line'); + } + +}