コード例 #1
0
ファイル: MailerTest.php プロジェクト: kobabasu/rest-slim
 /**
  * 正常系 ログファイルのパスが取得できるか
  *
  * @covers Lib\SwiftMailer\Mailer::getPath()
  * @test testSetGetPath()
  */
 public function testSetGetPath()
 {
     $body = 'hello twig';
     $this->object->setFrom($GLOBALS['MAIL_FROM']);
     $this->object->setName($GLOBALS['MAIL_NAME']);
     $this->object->setMessage('タイトル', $body);
     $this->object->send('*****@*****.**');
     $res = $this->object->getPath();
     $this->assertInternalType('string', $res);
 }
コード例 #2
0
 /**
  * 正常系 添付画像を含むメッセージを返すか
  *
  * @covers Lib\SwiftMailer\Mailer::send()
  * @test testSetSendAttachmentNormal()
  */
 public function testSendAttachmentNormal()
 {
     $body = $this->object->setTemplate('defaultTest.twig', array('name' => '太郎'));
     $this->object->setAttachment('tests/imgs/test.jpg', 'image/jpeg', 'test');
     $this->object->setFrom($GLOBALS['MAIL_FROM']);
     $this->object->setName($GLOBALS['MAIL_NAME']);
     $this->object->setMessage('添付画像テスト', $body);
     $res = $this->object->send('*****@*****.**');
     $this->assertEquals(1, $res);
 }
コード例 #3
0
ファイル: tbl_indexes.lib.php プロジェクト: lcylp/wamp
/**
 * Function to get the sql query for index creation or edit
 *
 * @param string $db     current db
 * @param string $table  current table
 * @param Object $index  current index
 * @param bool   &$error whether error occoured or not
 *
 * @return string
 */
function PMA_getSqlQueryForIndexCreateOrEdit($db, $table, $index, &$error)
{
    // $sql_query is the one displayed in the query box
    $sql_query = 'ALTER TABLE ' . PMA_Util::backquote($db) . '.' . PMA_Util::backquote($table);
    // Drops the old index
    if (!empty($_REQUEST['old_index'])) {
        if ($_REQUEST['old_index'] == 'PRIMARY') {
            $sql_query .= ' DROP PRIMARY KEY,';
        } else {
            $sql_query .= ' DROP INDEX ' . PMA_Util::backquote($_REQUEST['old_index']) . ',';
        }
    }
    // end if
    // Builds the new one
    switch ($index->getType()) {
        case 'PRIMARY':
            if ($index->getName() == '') {
                $index->setName('PRIMARY');
            } elseif ($index->getName() != 'PRIMARY') {
                $error = PMA_Message::error(__('The name of the primary key must be "PRIMARY"!'));
            }
            $sql_query .= ' ADD PRIMARY KEY';
            break;
        case 'FULLTEXT':
        case 'UNIQUE':
        case 'INDEX':
        case 'SPATIAL':
            if ($index->getName() == 'PRIMARY') {
                $error = PMA_Message::error(__('Can\'t rename index to PRIMARY!'));
            }
            $sql_query .= ' ADD ' . $index->getType() . ' ' . ($index->getName() ? PMA_Util::backquote($index->getName()) : '');
            break;
    }
    // end switch
    $index_fields = array();
    foreach ($index->getColumns() as $key => $column) {
        $index_fields[$key] = PMA_Util::backquote($column->getName());
        if ($column->getSubPart()) {
            $index_fields[$key] .= '(' . $column->getSubPart() . ')';
        }
    }
    // end while
    if (empty($index_fields)) {
        $error = PMA_Message::error(__('No index parts defined!'));
    } else {
        $sql_query .= ' (' . implode(', ', $index_fields) . ')';
    }
    if (PMA_MYSQL_INT_VERSION > 50500) {
        $sql_query .= "COMMENT '" . PMA_Util::sqlAddSlashes($index->getComment()) . "'";
    }
    $sql_query .= ';';
    return $sql_query;
}
コード例 #4
0
 /**
  * Set up the test environment
  *
  * @return void
  * @author Dan Cox
  */
 public function setUp()
 {
     $this->application = new Application();
     $this->application->setName('Test CLI')->setVersion('1.0');
 }
コード例 #5
0
ファイル: testfall4.php プロジェクト: la3mmchen/MasterThesis
<?php

/**
  * @desc Testfall 4
  * @needs $_POST['object']
*/
include 'object.php';
// Objekt-Klasse für Datenstrukturierung
switch ($_SERVER['REQUEST_METHOD']) {
    case "POST":
        $input = json_decode($_POST['object']);
        if ($input != NULL) {
            $tmp = new Object();
            $tmp->setId(substr($_SERVER['PATH_INFO'], 1));
            $tmp->setName($input->Name);
            $dbHandle = mysql_connect("localhost", "root", "pass") or die("keine dbHandle möglich.");
            mysql_select_db("express") or die("Die Datenbank existiert nicht.");
            $InsertSql = "INSERT INTO tbl_person (Id, Name) VALUES('" . $tmp->Id . "', '" . $tmp->Name . "')";
            $result = mysql_query($InsertSql);
            $SelectSql = "SELECT UniqId FROM tbl_person WHERE UniqId = " . mysql_insert_id() . "";
            $SelectResult = mysql_query($SelectSql);
            $ResultRow = mysql_fetch_object($SelectResult);
            mysql_close($dbHandle);
            $tmp->UniqId = $ResultRow->UniqId;
            if ($result) {
                header("Content-Type: application/json");
                header("HTTP/1.1 201 Created");
                header("Location: /object/" . $tmp->UniqId);
                echo $tmp->getJson();
            } else {
                header("Content-Type: application/json");
コード例 #6
0
 /**
  * Set value of 'name' field
  *
  * @access public   
  * @param string $value
  * @return boolean
  */
 function setObjectName($value)
 {
     return $this->object->setName($value);
 }
コード例 #7
0
 function testIncludes()
 {
     // add an object
     $object = new Object();
     $object->setName('Object name');
     $this->tpl->assign('object', $object);
     $this->runTests('Object name', 'include.tpl');
     // add an object
     $object = new Object();
     $object->setName('Object name');
     $this->tpl->assign('object', $object);
     $this->runTests('Object name', 'include_with_quotes.tpl');
 }