summaryrefslogtreecommitdiffstats
path: root/application/tests/test_service_files.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2015-05-21 14:45:53 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-05-21 18:43:13 +0200
commit77198abd94437eb418f11957695986470b1afc9a (patch)
tree710b0285a00aa3f54db274ff01a9eb21017c2164 /application/tests/test_service_files.php
parenteb9daf07b1a118b473d352c98c5822c3063e598d (diff)
tests: Make prove --state work; Restructure tests
This moves all tests into a subdirectory and lets prove itself figure out which tests exist. It seems if you supply the testlist via arguments or stdin --state won't affect the order. Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/tests/test_service_files.php')
-rw-r--r--application/tests/test_service_files.php85
1 files changed, 0 insertions, 85 deletions
diff --git a/application/tests/test_service_files.php b/application/tests/test_service_files.php
deleted file mode 100644
index 8789a9888..000000000
--- a/application/tests/test_service_files.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-/*
- * Copyright 2015 Florian "Bluewind" Pritz <bluewind@server-speed.net>
- *
- * Licensed under AGPLv3
- * (see COPYING for full license text)
- *
- */
-
-namespace tests;
-
-class test_service_files extends Test {
-
- public function __construct()
- {
- parent::__construct();
-
- $CI =& get_instance();
- $CI->load->model("muser");
- $CI->load->model("mfile");
-
- }
-
- public function test_verify_uploaded_files_noFiles()
- {
- $a = array();
- try {
- \service\files::verify_uploaded_files($a);
- $this->t->fail("verify should error");
- } catch (\exceptions\UserInputException $e) {
- $this->t->is($e->get_error_id(), "file/no-file", "verify should error");
- }
- }
-
- public function test_verify_uploaded_files_normal()
- {
- $CI =& get_instance();
- $a = array(
- array(
- "name" => "foobar.txt",
- "type" => "text/plain",
- "tmp_name" => NULL,
- "error" => UPLOAD_ERR_OK,
- "size" => 1,
- "formfield" => "file[1]",
- )
- );
-
- \service\files::verify_uploaded_files($a);
- $this->t->pass("verify should work");
- }
-
- public function test_verify_uploaded_files_uploadError()
- {
- $CI =& get_instance();
- $a = array(
- array(
- "name" => "foobar.txt",
- "type" => "text/plain",
- "tmp_name" => NULL,
- "error" => UPLOAD_ERR_NO_FILE,
- "size" => 1,
- "formfield" => "file[1]",
- )
- );
-
- try {
- \service\files::verify_uploaded_files($a);
- $this->t->fail("verify should error");
- } catch (\exceptions\UserInputException $e) {
- $data = $e->get_data();
- $this->t->is($e->get_error_id(), "file/upload-verify", "verify should error");
- $this->t->is_deeply(array(
- 'file[1]' => array(
- 'filename' => 'foobar.txt',
- 'formfield' => 'file[1]',
- 'message' => 'No file was uploaded',
- ),
- ), $data, "expected data in exception");
- }
- }
-
-
-}
-