本文整理汇总了PHP中Ak::test方法的典型用法代码示例。如果您正苦于以下问题:PHP Ak::test方法的具体用法?PHP Ak::test怎么用?PHP Ak::test使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ak
的用法示例。
在下文中一共展示了Ak::test方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dirname
<?php
require_once dirname(__FILE__) . '/../../fixtures/config/config.php';
require_once AK_LIB_DIR . DS . 'Ak.php';
class test_Ak_support_functions extends AkUnitTest
{
function test_for_importing_models()
{
$models = 'ImportTestModelA, import_test_model_b';
$this->assertFalse(class_exists('ImportTestModelA'));
$this->assertFalse(class_exists('ImportTestModelB'));
$this->assertEqual(Ak::import($models), array('ImportTestModelA', 'ImportTestModelB'));
$this->assertTrue(class_exists('ImportTestModelA'));
$this->assertTrue(class_exists('ImportTestModelB'));
$models = array('ImportTestModelB', 'Import Test Model C');
$this->assertEqual(Ak::import($models), array('ImportTestModelB', 'ImportTestModelC'));
$this->assertTrue(class_exists('ImportTestModelC'));
}
}
Ak::test('test_Ak_support_functions');
示例2: array
<option value="April">April</option>
<option value="May">May</option>
<option value="June" selected="selected">June</option>
<option value="July">July</option>
<option value="August">August</option>
<option value="September">September</option>
<option value="October">October</option>
<option value="November">November</option>
<option value="December">December</option>
</select>
<select name="dateyear">
<option value="1973">1973</option>
<option value="1974">1974</option>
<option value="1975">1975</option>
<option value="1976">1976</option>
<option value="1977">1977</option>
<option value="1978" selected="selected">1978</option>
<option value="1979">1979</option>
<option value="1980">1980</option>
<option value="1981">1981</option>
<option value="1982">1982</option>
<option value="1983">1983</option>
</select>'), array(''))));
//echo DateHelper::distance_of_time_in_words('1779-12-01','1780-01-01');
}
}
Ak::test('DateHelperTests');
示例3: defined
<?php
defined('AK_TEST_DATABASE_ON') ? null : define('AK_TEST_DATABASE_ON', true);
require_once dirname(__FILE__) . '/../../../fixtures/config/config.php';
class test_AkActionViewHelper extends UnitTestCase
{
}
Ak::test('test_AkActionViewHelper', true);
示例4: shell_exec
//, 'Failed auto_link_email_addresses test');
$this->assertEqual($text->strip_selected_tags('sending <b>email</b> to <a href="mailto:salavert@example.com">salavert@example.com</a>', 'a'), 'sending <b>email</b> to salavert@example.com');
//, 'Failed auto_link_email_addresses test');
$this->assertEqual($text->auto_link('email sent to salavert@example.com from http://www.thebigmover.com', 'all'), 'email sent to <a href=\'mailto:salavert@example.com\'>salavert@example.com</a> from <a href="http://www.thebigmover.com">http://www.thebigmover.com</a>');
$this->assertEqual($text->auto_link('email sent to salavert@example.com', 'email_addresses'), 'email sent to <a href=\'mailto:salavert@example.com\'>salavert@example.com</a>');
$this->assertEqual($text->auto_link('email sent from http://www.thebigmover.com', 'urls'), 'email sent from <a href="http://www.thebigmover.com">http://www.thebigmover.com</a>');
$this->assertEqual($text->strip_tags('<a href="nowhere" onclick="javascript:alert(\'oops\');">link</a>'), 'link');
$this->assertEqual($text->markdown('> ## This is a header.
>
> 1. This is the first list item.
> 2. This is the second list item.
>
> Here\'s some example code:
>
> return shell_exec("echo $input | $markdown_script");'), '<blockquote>
<h2>This is a header.</h2>
<ol>
<li>This is the first list item.</li>
<li>This is the second list item.</li>
</ol>
<p>Here\'s some example code:</p>
<pre><code>return shell_exec("echo $input | $markdown_script");
</code></pre>
</blockquote>');
}
}
Ak::test('TextHelperTests');
示例5: test_TagHelper
<?php
require_once '_HelpersUnitTester.php';
require_once AK_LIB_DIR . DS . 'AkActionView' . DS . 'helpers' . DS . 'tag_helper.php';
class TagHelperTests extends HelpersUnitTester
{
function test_TagHelper()
{
$this->assertEqual(TagHelper::tag('br'), '<br />');
$this->assertEqual(TagHelper::tag('input', array('type' => 'text', 'value' => 'Insert your text >> "HERE"')), '<input type="text" value="Insert your text >> "HERE"" />');
$this->assertEqual(TagHelper::tag('hr', array('style' => '', 1234 => 'This is not possible')), '<hr />');
$this->assertEqual(TagHelper::content_tag('p', 'Have a look "HERE"'), '<p>Have a look "HERE"</p>');
$this->assertEqual(TagHelper::content_tag('textarea', 'Have a look "HERE"', array('name' => 'details')), '<textarea name="details">Have a look "HERE"</textarea>');
$this->assertEqual(TagHelper::cdata_section('Have a look "HERE"'), '<![CDATA[Have a look "HERE"]]>');
}
}
Ak::test('TagHelperTests');
示例6: tests_pending
<?php
require_once '_HelpersUnitTester.php';
require_once AK_LIB_DIR . DS . 'AkActionView' . DS . 'helpers' . DS . 'capture_helper.php';
class CaptureHelperTests extends HelpersUnitTester
{
/**
* @todo Add tests for capture helper
*/
function tests_pending()
{
}
}
Ak::test('CaptureHelperTests');
示例7: test_language_change
function test_language_change()
{
$this->assertEqual(array('en', 'es'), Ak::langs());
$this->addHeader('Accept-Language: es,en-us,en;q=0.5');
$this->get(AK_TESTING_URL . '/locale_detection/get_language');
$this->assertTextMatch('es');
$this->get(AK_TESTING_URL . '/locale_detection/get_param/?param=message&message=Hello');
$this->assertTextMatch('Hello');
$this->get(AK_TESTING_URL . '/locale_detection/get_param/?param=lang&lang=en');
$this->assertTextMatch('en');
$this->get(AK_TESTING_URL . '/locale_detection/get_language/?lang=en');
$this->assertTextMatch('en');
$this->get(AK_TESTING_URL . '/locale_detection/get_language');
$this->assertTextMatch('en');
$this->get(AK_TESTING_URL . '/locale_detection/get_language/?lang=invalid');
$this->assertTextMatch('en');
}
function test_language_change_on_ak()
{
$this->assertEqual(array('en', 'es'), Ak::langs());
$this->addHeader('Accept-Language: es,en-us,en;q=0.5');
$this->get(AK_TESTING_URL . '/locale_detection/get_language');
$this->assertTextMatch('es');
$this->get(AK_TESTING_URL . '/en/locale_detection/get_language/');
$this->assertTextMatch('en');
$this->get(AK_TESTING_URL . '/locale_detection/get_language');
$this->assertTextMatch('en');
}
}
Ak::test('_AkActionController_locale_detection');
示例8: array
$input_value = array('controller' => 'blog', 'action' => 'view', 'id' => 'newest', 'format' => 'printer_friendly');
$expected = AK_URL_REWRITE_ENABLED ? '/blog/view/newest/?format=printer_friendly' : '/?ak=/blog/view/newest/&format=printer_friendly';
$this->assertEqual($this->Router->toUrl($input_value), $expected);
$input_value = array('controller' => 'articles', 'action' => 'view_headlines', 'year' => '2005', 'month' => '10', 'day' => null);
$expected = $this->url_prefix . '/2005/10/';
$this->assertEqual($this->Router->toUrl($input_value), $expected);
$input_value = array('controller' => 'articles', 'action' => 'view_headlines', 'year' => '2006', 'month' => 'all', 'day' => null);
$expected = $this->url_prefix . '/2006/';
$this->assertEqual($this->Router->toUrl($input_value), $expected);
$input_value = array('controller' => 'user', 'action' => 'list', 'id' => '12');
$expected = $this->url_prefix . '/user/list/12/';
$this->assertEqual($this->Router->toUrl($input_value), $expected);
$input_value = array('controller' => 'setup', 'config_settings' => array('themes', 'clone', '12'));
$expected = $this->url_prefix . '/setup/themes/clone/12/';
$this->assertEqual($this->Router->toUrl($input_value), $expected);
$input_value = array('controller' => 'themes', 'options' => array('blue', 'css', 'sans_serif'), 'action' => 'clone');
$expected = $this->url_prefix . '/customize/blue/css/sans_serif/clone/';
$this->assertEqual($this->Router->toUrl($input_value), $expected);
}
function test_url_with_optional_variables()
{
$input_value = array('controller' => 'topic', 'action' => 'view', 'id' => 4);
$expected = $this->url_prefix . '/topic/4/';
$this->assertEqual($this->Router->toUrl($input_value), $expected);
$input_value = array('controller' => 'topic', 'action' => 'unread', 'id' => 4);
$expected = $this->url_prefix . '/topic/4/unread/';
$this->assertEqual($this->Router->toUrl($input_value), $expected);
}
}
Ak::test('Test_of_AkRouter_Class');
示例9: tests_pending
<?php
require_once '_HelpersUnitTester.php';
require_once AK_LIB_DIR . DS . 'AkActionView' . DS . 'helpers' . DS . 'pagination_helper.php';
class PaginationHelperTests extends HelpersUnitTester
{
/**
* @todo Add tests for pagination helper
*/
function tests_pending()
{
}
}
Ak::test('PaginationHelperTests');
示例10: dirname
<?php
require_once dirname(__FILE__) . '/../../fixtures/config/config.php';
require_once AK_LIB_DIR . DS . 'Ak.php';
class test_Ak_var_manipulation extends UnitTestCase
{
function test_for_to_array()
{
$this->assertEqual(Ak::toArray('es,en,va'), array('es', 'en', 'va'));
}
function test_for_string_to_array()
{
$this->assertEqual(Ak::stringToArray('es,en,va'), array('es', 'en', 'va'));
$this->assertEqual(Ak::stringToArray('es , en , va'), array('es', 'en', 'va'));
}
}
Ak::test('test_Ak_var_manipulation');
示例11: Test_of_get_and_set_DisplayField
$this->assertTrue($AkTestField->decimal_field === 0);
$this->assertTrue($AkTestField->get('decimal_field') === 0);
$AkTestField->decrementAttribute('decimal_field');
$this->assertTrue($AkTestField->decimal_field === -1);
$this->assertTrue($AkTestField->get('decimal_field') === -1);
}
function Test_of_get_and_set_DisplayField()
{
$AkTestField = new AkTestField();
$this->assertEqual($AkTestField->getDisplayField(), 'id');
$AkTestField->setDisplayField('text_field');
$this->assertEqual($AkTestField->getDisplayField(), 'text_field');
$AkTestUser = new AkTestUser();
$this->assertEqual($AkTestUser->getDisplayField(), 'id');
$AkTestUser->addCombinedAttributeConfiguration('name', "%s %s", 'first_name', 'last_name');
$this->assertEqual($AkTestUser->getDisplayField(), 'name');
$AkTestField->setDisplayField('invalid_field');
$this->assertEqual($AkTestUser->getDisplayField(), 'name');
}
function Test_of_get_and_get_Id()
{
$AkTestField = new AkTestField();
$this->assertEqual($AkTestField->getId(), null);
$AkTestField->setId(123);
$this->assertEqual($AkTestField->getId(), 123);
$AkTestField->incrementAttribute($AkTestField->getPrimaryKey());
$this->assertEqual($AkTestField->getId(), 124);
}
}
Ak::test('test_AkActiveRecord', true);
示例12: Test_read_write
$this->assertWantedText($expected_session_id, 'Sessions are not working correctly');
}
function Test_read_write()
{
$expected = 'test_value';
$this->get("{$this->_test_script}?key=test_key&value={$expected}");
$this->get("{$this->_test_script}?key=test_key");
$this->assertWantedText($expected, 'Session is not storing values on database correctly when calling ' . $this->_test_script . '?key=test_key');
}
function Test_destroy()
{
$expected = 'value not found';
$this->get("{$this->_test_script}?key=test_key&value=test_value");
$this->get("{$this->_test_script}?destroy_check=1");
$this->get("{$this->_test_script}?key=test_key");
$this->assertWantedText($expected, 'session_destroy(); is not working as expected');
}
function Test_gc()
{
$expected = 'value not found';
$copy = $this;
$copy->get("{$this->_test_script}?key=test_key&value=test_value&expire=1");
sleep(3);
$this->restart();
$this->get("{$this->_test_script}?dumb_call_for_activating_gc");
$copy->get("{$this->_test_script}?key=test_key");
$this->assertWantedText($expected, 'Session garbage collection is not working correctly');
}
}
Ak::test('Test_of_AkDbSession_Class', true);
示例13: MockAkActionController
$Controller =& new MockAkActionController($this);
$Controller->setReturnValue('urlFor', '/url/for/test');
//$Controller->setReturnValue('_getCompleteRequestUri','/url/for/test');
$url = new UrlHelper();
$url->setController($Controller);
$this->assertReference($Controller, $url->_controller);
$input = array('disabled' => 1, 'checked' => false, 'selected' => '');
$expected = array('disabled' => 'disabled');
$this->assertEqual($url->_convert_boolean_attributes($input, array('disabled', 'checked', 'selected')), $expected);
$input = array('disabled' => true, 'id' => 'hithere');
$expected = array('disabled' => 'disabled', 'id' => 'hithere');
$this->assertEqual($url->_convert_boolean_attributes($input, 'disabled'), $expected);
$this->assertEqual($url->url_for(array('action' => 'create')), '/url/for/test');
$this->assertEqual($url->button_to('Edit'), '<form method="post" action="/url/for/test" class="button-to"><div>' . '<input type="submit" value="Edit" /></div></form>');
$this->assertEqual($url->link_to('Delete this page', array('action' => 'destroy', 'id' => 3), array('confirm' => 'Are you sure?')), '<a href="/url/for/test" onclick="return confirm(\'Are you sure?\');">Delete this page</a>');
$this->assertEqual($url->link_to('Help', array('action' => 'help'), array('popup' => true)), '<a href="/url/for/test" onclick="window.open(this.href);return false;">Help</a>');
$this->assertEqual($url->link_to('Help', array('action' => 'help'), array('popup' => true, 'confirm' => 'Are you sure?')), '<a href="/url/for/test" onclick="if (confirm(\'Are you sure?\')) { window.open(this.href); };return false;">Help</a>');
$this->assertEqual($url->link_to('Help', array('action' => 'help'), array('post' => true)), '<a href="/url/for/test" onclick="var f = document.createElement(\'form\'); document.body.appendChild(f); f.method = \'POST\'; f.action = this.href; f.submit();return false;">Help</a>');
$this->assertEqual($url->link_to('Destroy account', array('action' => 'destroy'), array('confirm' => 'Are you sure?'), array('post' => true)), '<a href="/url/for/test" onclick="return confirm(\'Are you sure?\');">Destroy account</a>');
$this->assertEqual($url->link_to_unless(true, 'Destroy account', array('action' => 'destroy'), array('confirm' => 'Are you sure?'), array('post' => true)), '');
$this->assertEqual($url->link_to_unless(false, 'Destroy account', array('action' => 'destroy'), array('confirm' => 'Are you sure?'), array('post' => true)), '<a href="/url/for/test" onclick="return confirm(\'Are you sure?\');">Destroy account</a>');
$this->assertEqual($url->_popup_javascript_function('A'), 'window.open(this.href);');
$this->assertEqual($url->_popup_javascript_function(array('A', 'B', 'C')), 'window.open(this.href,\'A\',\'C\');');
$this->assertEqual($url->_confirm_javascript_function('Are you sure?'), 'confirm(\'Are you sure?\')');
$this->assertEqual($url->mail_to('me@domain.com', 'My email', array('cc' => 'ccaddress@domain.com', 'bcc' => 'bccaddress@domain.com', 'subject' => 'This is an example email', 'body' => 'This is the body of the message.')), '<a href="mailto:me@domain.com?cc=ccaddress%40domain.com&bcc=bccaddress%40domain.com&body=This%20is%20the%20body%20of%20the%20message.&subject=This%20is%20an%20example%20email">My email</a>');
$this->assertEqual($url->mail_to('me@domain.com', 'My email', array('encode' => 'javascript')), '<script type="text/javascript">eval(unescape(\'%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%27%3c%61%20%68%72%65%66%3d%22%6d%61%69%6c%74%6f%3a%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d%22%3e%4d%79%20%65%6d%61%69%6c%3c%2f%61%3e%27%29%3b\'))</script>');
$this->assertEqual($url->mail_to('me@domain.com', 'My email', array('encode' => 'hex')), '<a href="mailto:%6d%65%40%64%6f%6d%61%69%6e%2e%63%6f%6d">My email</a>');
}
}
Ak::test('UrlHelperTests');
示例14: test_for_JavascriptHelper
<?php
require_once '_HelpersUnitTester.php';
require_once AK_LIB_DIR . DS . 'AkActionView' . DS . 'helpers' . DS . 'javascript_helper.php';
class JavaScriptHelperTests extends HelpersUnitTester
{
function test_for_JavascriptHelper()
{
require_once AK_LIB_DIR . DS . 'AkActionView' . DS . 'helpers' . DS . 'javascript_helper.php';
$javascript = new JavaScriptHelper();
$this->assertEqual($javascript->link_to_function('Greeting', "alert('Hello world!')"), '<a href="#" onclick="alert(\'Hello world!\'); return false;">Greeting</a>');
$this->assertEqual($javascript->link_to_function('my link', "if confirm('Really?'){ do_delete(); }", array('href' => 'http://www.akelos.com')), '<a href="http://www.akelos.com" onclick="if confirm(\'Really?\'){ do_delete(); }; return false;">my link</a>');
$this->assertEqual($javascript->button_to_function("Greeting", "alert('Hello world!')"), '<input onclick="alert(\'Hello world!\');" type="button" value="Greeting" />');
$this->assertEqual($javascript->button_to_function("Delete", "if confirm('Really?'){ do_delete(); }", array('id' => 'confirm')), '<input id="confirm" onclick="if confirm(\'Really?\'){ do_delete(); };" type="button" value="Delete" />');
$this->assertEqual($javascript->javascript_tag("alert('All is good')"), "<script type=\"text/javascript\">\n//<![CDATA[\nalert('All is good')\n//]]>\n</script>");
$input = "\n <div id='meesage'\n \n class=\"hisghtlight\" />\n ";
$expected = "\\n <div id=\\'meesage\\'\\n \\n class=\\\"hisghtlight\\\" />\\n ";
$this->assertEqual($javascript->escape_javascript($input), $expected);
}
}
Ak::test('JavaScriptHelperTests');
示例15: _getNestedSetList
{
$this->_deleteTestingModelDatabases();
$this->_createNewTestingModelDatabase('AkTestNestedCategory');
}
function _getNestedSetList($Categories = null, $breadcrumb = false)
{
if (!isset($Categories)) {
$Categories = new AkTestNestedCategory();
$Categories = $Categories->find('all', array('conditions' => $Categories->nested_set->getScopeCondition(), 'order' => ' lft ASC '));
}
$list = array();
foreach ($Categories as $Category) {
$bread_crumb = '';
if ($Parents = $Category->nested_set->getParents()) {
foreach ($Parents as $Parent) {
$bread_crumb .= $Parent->description . ' > ';
}
}
if ($breadcrumb) {
$list[] = $bread_crumb . "(" . $Category->id . ")" . $Category->description;
//
} else {
$list[$Category->parent_id][$Category->id] = $Category->lft . ' <- ' . $Category->description . ' ->' . $Category->rgt;
// getAttributes();
}
}
return $list;
}
}
Ak::test('test_AkActiveRecord_actsAsNestedSet', true);