bufon2211 6 anni fa
parent
commit
6fa7a8aa68
1 ha cambiato i file con 40 aggiunte e 0 eliminazioni
  1. 40 0
      test/StudentTests.php

+ 40 - 0
test/StudentTests.php

@@ -0,0 +1,40 @@
+<?php
+/**
+ * Created by PhpStorm.
+ * User: mrs
+ * Date: 15.01.2018
+ * Time: 16:54
+ */
+
+namespace Test;
+
+use App\Model\Student;
+use PHPUnit\Framework\TestCase;
+
+
+include_once('repository/RepositoryAbstract.php');
+include_once('repository/StudentRepository.php');
+include_once('model/Student.php');
+include_once('config/DbConnection.php');
+
+class StudentTests extends TestCase
+{
+
+    public function testShortFirstnameValidation()
+    {
+        $student = new Student('a', 'lastname', '3-A');
+        $this->assertFalse($student->validate());
+    }
+
+    public function testShortLastnameValidation()
+    {
+        $student = new Student('firstname', 'b', '3-A');
+        $this->assertFalse($student->validate());
+    }
+
+    public function testShortClassValidation()
+    {
+        $student = new Student('firstname', 'lastname', '3');
+        $this->assertFalse($student->validate());
+    }
+}