dereuromark 15 年 前
コミット
5271852bc3

+ 50 - 0
models/contact.php

@@ -0,0 +1,50 @@
+<?php
+class Contact extends ToolsAppModel {
+
+	var $name = 'Contact';
+	var $useTable = false;
+	
+	var $validate = array(
+		'name' => array(
+				'notEmpty' => array(
+						'rule' => array('notEmpty'),
+						'message' => 'valErrMandatoryField'
+			)
+				),
+				'email' => array(
+					'email' => array(
+						'rule' => array('email', true),
+						'message' => 'valErrInvalidEmail'
+			),
+		), 
+		'subject' => array(
+				'notEmpty' => array(
+						'rule' => array('notEmpty'),
+						'message' => 'valErrMandatoryField',
+						'required' => true
+			)
+				), 
+		'message' => array(
+				'notEmpty' => array(
+						'rule' => array('notEmpty'),
+						'message' => 'valErrMandatoryField',
+						'required' => true
+			)
+				),
+	);
+
+
+
+	function schema() {
+				return array(
+			'name' => array('type' => 'string' , 'null' => false, 'default' => '', 'length' => '30'),
+						'email'    => array('type' => 'string' , 'null' => false, 'default' => '', 'length' => '60'),
+						'subject'  => array('type' => 'string' , 'null' => false, 'default' => '', 'length' => '60'),
+						'message'  => array('type' => 'text' , 'null' => false, 'default' => ''),
+			);
+		}
+
+
+
+}
+?>

+ 24 - 0
tests/cases/behaviors/captcha.test.php

@@ -0,0 +1,24 @@
+<?php
+
+class CaptchaTest extends CakeTestCase {
+
+/**
+ * setUp method
+ */
+	function setUp() {
+
+	}
+
+/**
+ * Tear-down method.  Resets environment state.
+ */
+	function tearDown() {
+
+	}
+
+
+	//TODO
+
+}
+
+?>

+ 1 - 1
tests/cases/helpers/captcha.test.php

@@ -1,6 +1,6 @@
 <?php
 <?php
 
 
-App::import('Helper', 'Captcha');
+App::import('Helper', 'Tools.Captcha');
 App::import('Helper', 'Html');
 App::import('Helper', 'Html');
 
 
 /**
 /**

+ 22 - 0
tests/cases/models/contact.test.php

@@ -0,0 +1,22 @@
+<?php
+
+App::import('Model', 'Tools.Contact');
+
+class ContactTestCase extends CakeTestCase {
+	var $Contact = null;
+	//var $fixtures = array('app.code_key');
+
+	function startTest() {
+		$this->Contact =& ClassRegistry::init('Contact');
+	}
+
+	function testContactInstance() {
+		$this->assertTrue(is_a($this->Contact, 'Contact'));
+	}
+
+
+	//TODO
+
+
+}
+?>