Пример #1
0
<?php

/**
 * This file is part of the sfSearch package.
 * (c) Carl Vondrick <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require dirname(__FILE__) . '/../bootstrap/functional.php';
require 'mock/engine/xfMockEngine.class.php';
bootstrap('frontend');
$index = xfIndexManager::get('TestSearch');
$index->setEngine(new xfMockEngine());
$b = new xfTestBrowser();
$b->get('search/search', array('do' => 'search', 'search' => array('query' => 'foobar')))->isStatusCode(200)->isRequestParameter('module', 'search')->isRequestParameter('action', 'search')->checkResponseElement('title', 'No Search Results')->checkResponseElement('h2', 'No Search Results', array('position' => 0))->checkResponseElement('form[method="get"]', true)->checkResponseElement('form label[for="search_query"]', 'Query')->checkResponseElement('form input[id="search_query"]', true)->checkResponseElement('form input[id="search_query"][value="foobar"]', true)->checkResponseElement('form input[type="submit"]', true);
<?php

/**
 * This file is part of the sfSearch package.
 * (c) Carl Vondrick <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require dirname(__FILE__) . '/../../bootstrap/unit.php';
require 'index/xfIndexManager.class.php';
require 'mock/index/xfMockIndex.class.php';
require 'log/xfLogger.interface.php';
require 'log/xfLoggerBlackhole.class.php';
require 'util/xfException.class.php';
$t = new lime_test(3, new lime_output_color());
$index = xfIndexManager::get('xfMockIndex');
$t->isa_ok($index, 'xfMockIndex', '->getIndex() retuns an instance of the index');
$t->ok($index === xfIndexManager::get('xfMockIndex'), '->getIndex() is a singleton method');
try {
    $msg = '->getIndex() fails if index does not inherit xfIndex';
    xfIndexManager::get('Exception');
    $t->fail($msg);
} catch (Exception $e) {
    $t->pass($msg);
}