#2 PHPUnit integration

Отворено
noa жели да споји 6 комит(е) из noa/feature/test у noa/develop
3 измењених фајлова са 65 додато и 0 уклоњено
  1. 46 0
      src/api/v1.0/object/json.Users.php
  2. 4 0
      src/composer.json
  3. 15 0
      src/tests/api/json.UsersTest.php

+ 46 - 0
src/api/v1.0/object/json.Users.php

@@ -0,0 +1,46 @@
+<?php
+
+require_once API_DIR.'/v1.0/json.AbstractJson.php';
+
+/**
+ * Basic example to try api
+ *
+ */
+
+class Test extends AbstractJson
+{
+
+    /**
+     * @var string Dummy string value
+     */
+    protected $value = '';
+
+    public function post_test()
+    {
+
+        // Check authorization
+        // TODO ...
+
+        $message = sprintf("This is the value passed from post value : %s", $this->value);
+
+        return array(
+            "status" => ApiStatus::API_SUCCESS_STATUS,
+            "message" => $message,
+        );
+    }
+
+    public function get_test()
+    {
+        $message = sprintf("This is the value passed from post value : %s", $this->value);
+
+        return array(
+            "status" => ApiStatus::API_SUCCESS_STATUS,
+            "message" => $message,
+        );
+    }
+
+    protected function get_protected()
+    {
+
+    }
+}

+ 4 - 0
src/composer.json

@@ -12,5 +12,9 @@
   "require": {
     "flow/flow": "0.7.2",
     "panique/php-sass": "v1.0"
+  },
+
+  "require-dev": {
+    "phpunit/phpunit": "4.8"
   }
 }

+ 15 - 0
src/tests/api/json.UsersTest.php

@@ -0,0 +1,15 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: Noa
+ * Date: 30/04/2016
+ * Time: 15:11
+ */
+
+class UsersTest extends PHPUnit_Framework_TestCase {
+
+    public function testGet() {
+        self::assertEquals(true, true);
+    }
+
+}