本文整理汇总了PHP中ak_test函数的典型用法代码示例。如果您正苦于以下问题:PHP ak_test函数的具体用法?PHP ak_test怎么用?PHP ak_test使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ak_test函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AkTestUser
{
$AkTestUser = new AkTestUser();
$AkTestUser->getColumns();
// Loads settings
$AkTestUser->resetColumnInformation();
$this->assertTrue(empty($AkTestUser->_columnNames) && empty($AkTestUser->_columns) && empty($AkTestUser->_columnsSettings) && empty($AkTestUser->_contentColumns));
}
function Test_of_freeze_and_isFrozen()
{
$AkTestMember = new AkTestMember();
$this->assertFalse($AkTestMember->isFrozen());
$AkTestMember->freeze();
$this->assertTrue($AkTestMember->isFrozen());
}
function Test_of_count()
{
$AkTestUser = new AkTestUser();
$this->assertEqual($AkTestUser->count(), count($AkTestUser->find()));
$this->assertEqual($AkTestUser->count("first_name = 'Tim'"), count($AkTestUser->findAll("first_name = 'Tim'")));
}
function Test_of_countBySql()
{
$AkTestUser = new AkTestUser();
$this->assertEqual($AkTestUser->countBySql("SELECT COUNT(*) FROM ak_test_users"), count($AkTestUser->find()));
$this->assertEqual($AkTestUser->countBySql("SELECT COUNT(*) FROM ak_test_users WHERE first_name = 'Tim'"), count($AkTestUser->findAll("first_name = 'Tim'")));
}
}
require_once '_AkActiveRecord_1.php';
require_once '_AkActiveRecord_2.php';
ak_test('test_AkActiveRecord_3', true);
示例2: AkReflectionClass
}';
$class = new AkReflectionClass($string);
$array = $class->_definition;
$class = new AkReflectionClass($array);
$this->assertEqual('Test', $class->getName());
$methods = $class->getMethods();
$this->assertEqual(2, count($methods));
$this->assertEqual('method1', $methods[0]->getName());
$this->assertFalse($methods[0]->returnByReference());
$this->assertEqual('method2', $methods[1]->getName());
$this->assertTrue($methods[1]->returnByReference());
$docBlock = $methods[1]->getDocBlock();
$this->assertTrue(is_a($docBlock, 'AkReflectionDocBlock'));
$this->assertEqual('comment', $docBlock->getComment());
$params = $docBlock->getParams();
$this->assertEqual(2, count($params));
$this->assertEqual('void', $docBlock->getTag('return'));
$voidMethods = $class->getMethods(array('tags' => array('return' => 'void')));
$this->assertEqual(1, count($voidMethods));
}
function test_get_methods_filtered()
{
$file = AK_TEST_DIR . DS . 'fixtures' . DS . 'data' . DS . 'reflection_test_class.php';
$class = new AkReflectionClass(file_get_contents($file));
$filteredMethods = $class->getMethods(array('tags' => array('WingsPluginInstallAs' => '.*')));
$this->assertEqual(1, count($filteredMethods));
$this->assertEqual('testFunction2', $filteredMethods[0]->getName());
}
}
ak_test('AkReflectionClass_TestCase', true);
示例3: test_strip_tags
}
function test_strip_tags()
{
$this->assertEqual($this->text->strip_tags('<a href="nowhere" onclick="javascript:alert(\'oops\');">link</a>'), 'link');
}
function test_markdown()
{
$this->assertEqual($this->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');
示例4: array
$this->assertEqual($number->number_to_phone(1235551234, array('delimiter' => ' ')), '123 555 1234');
$this->assertEqual($number->number_to_phone(1235551234, array('area_code' => true, 'extension' => 555)), '(123) 555-1234 x 555');
$this->assertEqual($number->number_to_currency("1234567890.50"), '$1,234,567,890.50');
$this->assertEqual($number->number_to_currency(123456789.123456, array('precision' => 2, 'unit' => ' Skk', 'unit_position' => 'right', 'separator' => ',', 'delimiter' => ' ')), '123 456 789,12 Skk');
$this->assertEqual($number->number_to_currency("1234567890.50"), '$1,234,567,890.50');
$this->assertEqual($number->number_to_currency(1234567890.506), '$1,234,567,890.51');
$this->assertEqual($number->number_to_currency(1234567890.5, array('unit' => "£", 'separator' => ",", 'delimiter' => "")), '£1234567890,50');
$this->assertEqual($number->number_to_currency(1234567890.5, array('unit' => " €", 'separator' => ",", 'delimiter' => ".", 'unit_position' => 'right')), '1.234.567.890,50 €');
$this->assertEqual($number->number_to_percentage(100), '100.00%');
$this->assertEqual($number->number_to_percentage(100, array('precision' => 0)), '100%');
$this->assertEqual($number->number_to_percentage(302.0576, array('precision' => 3)), '302.058%');
$this->assertEqual($number->number_with_delimiter(12345678), '12,345,678');
$this->assertEqual($number->number_with_delimiter(12345678.2), '12,345,678.2');
$this->assertEqual($number->human_size(123), '123 Bytes');
$this->assertEqual($number->human_size(1234), '1.2 KB');
$this->assertEqual($number->human_size(12345), '12.1 KB');
$this->assertEqual($number->human_size(1234567), '1.2 MB');
$this->assertEqual($number->human_size(1234567890), '1.1 GB');
$this->assertEqual($number->human_size_to_bytes('123 Bytes'), 123);
$this->assertEqual($number->human_size_to_bytes('1.2 KB'), 1229);
$this->assertEqual($number->human_size_to_bytes('12.1 KB'), 12391);
$this->assertEqual($number->human_size_to_bytes('1.2 MB'), 1258292);
$this->assertEqual($number->human_size_to_bytes('1.1 GB'), 1181116007);
$this->assertEqual($number->number_with_precision(111.2345), '111.235');
$this->assertEqual($number->zeropad(123, 6), '000123');
$this->assertEqual($number->zeropad('0123', 6), '000123');
$this->assertEqual($number->zeropad(12345, 2), '12345');
}
}
ak_test('NumberHelperTests');
示例5: AkT
$this->assertEqual('This Is A Test', $string->titleize());
$string =& AkT("ThisIsATest");
$this->assertEqual('This Is A Test', $string->titleize());
}
public function test_length()
{
$text = "this_is_a_test";
$string =& AkT($text);
$this->assertEqual(strlen($text), $string->length());
}
public function test_pluralize()
{
$text = "Comment";
$string =& AkT($text);
$this->assertEqual('Comments', $string->pluralize());
$string =& AkT($text, 'pluralize');
$this->assertEqual('Comments', $string);
$string = AkT('inglés', 'pluralize(es)');
$this->assertEqual('ingleses', $string);
}
public function test_singularize()
{
$text = "Comments";
$string =& AkT($text);
$this->assertEqual('Comment', $string->singularize());
$string =& AkT($text, 'singularize');
$this->assertEqual('Comment', $string);
}
}
ak_test('Test_AkString');
示例6: test_begin_without_label
}
function test_begin_without_label()
{
$str = "test CaptureHelper #1";
$this->capture_helper->begin();
echo $str;
$this->assertEqual($this->capture_helper->end(), $str);
$globals = AkActionView::_getGlobals();
$this->assertEqual(isset($globals['content_for_']) ? $globals['content_for_'] : null, null);
}
function test_begin_with_label()
{
$str = "test CaptureHelper #2";
$this->capture_helper->begin('test_2');
echo $str;
$this->assertEqual($this->capture_helper->end(), $str);
$globals = AkActionView::_getGlobals();
$this->assertEqual($globals['content_for_test_2'], $str);
}
function test_content_for()
{
$str = "test CaptureHelper content_for";
$this->capture_helper->content_for('content_for');
echo $str;
$this->assertEqual($this->capture_helper->end(), $str);
$globals = AkActionView::_getGlobals();
$this->assertEqual($globals['content_for_content_for'], $str);
}
}
ak_test('CaptureHelperTests');
示例7: Test_of_compress_decompress
$ecripted = Ak::encrypt($file, $key);
$this->assertEqual(Ak::decrypt($ecripted, $key), $file);
}
/**/
function Test_of_compress_decompress()
{
$original = Ak::file_get_contents(__FILE__);
$compressed = Ak::compress($original);
Ak::file_put_contents(AK_TMP_DIR . DS . 'gzip_test.gz', $compressed, array('base_path' => AK_TMP_DIR));
$this->assertTrue(strlen($compressed) < strlen($original));
$compressed_file = Ak::file_get_contents(AK_TMP_DIR . DS . 'gzip_test.gz', array('base_path' => AK_TMP_DIR));
$this->assertEqual($compressed_file, $compressed);
$uncompressed_from_file = Ak::uncompress($compressed_file);
$uncompressed_from_string = Ak::uncompress($compressed);
$this->assertEqual($uncompressed_from_file, $uncompressed_from_string);
}
/**/
function Test_for_StatusKeys()
{
$Object = new Ak();
$this->assertFalse(Ak::objectHasBeenModified($Object));
$this->assertEqual(Ak::getStatusKey($Object), Ak::getStatusKey($Object));
$Object->name = 'Bermi';
$this->assertTrue(Ak::objectHasBeenModified($Object));
$this->assertTrue(Ak::objectHasBeenModified($Object));
Ak::resetObjectModificationsWacther($Object);
$this->assertFalse(Ak::objectHasBeenModified($Object));
}
}
ak_test('test_of_Ak_object_inspection', true);
示例8: _getNestedSetList
public function _getNestedSetList($Categories = null, $breadcrumb = false)
{
if(!isset($Categories)){
$Categories = new NestedCategory();
$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);
?>
示例9: 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);
}
function test_javascript_tag()
{
$javascript = new JavaScriptHelper();
//static call
$this->AssertEqual(JavascriptHelper::javascript_tag("alert('test akelos');"), "<script type=\"text/javascript\">\n//<![CDATA[\nalert('test akelos');\n//]]>\n</script>");
//object call
$this->AssertEqual($javascript->javascript_tag("alert('test akelos');"), "<script type=\"text/javascript\">\n//<![CDATA[\nalert('test akelos');\n//]]>\n</script>");
}
}
ak_test('JavaScriptHelperTests');
示例10: test_center
{
$this->assertFalse($this->cross_meridian->contains($this->east_of_cm));
$this->assertFalse($this->cross_meridian->contains($this->west_of_cm));
}
function test_center()
{
$latlng = $this->bounds->center();
$this->assertWithinMargin(32.939828, $latlng->get('lat'), 5.0E-5);
$this->assertWithinMargin(-96.9511763, $latlng->get('lng'), 5.0E-5);
}
function xtest_center_cross_meridian()
{
$latlng = $this->cross_meridian->center();
$this->assertWithinMargin(35.4116, $latlng->get('lat'), 5.0E-5);
$this->assertWithinMargin(179.38112, $latlng->get('lng'), 5.0E-5);
}
function test_creation_from_circle()
{
$bounds = Bounds::from_point_and_radius(array(32.939829, -96.951176), 2.5);
$inside = new LatLng(32.969527, -96.99015900000001);
$outside = new LatLng(32.895155, -96.958444);
$this->assertTrue($bounds->contains($inside));
$this->assertFalse($bounds->contains($outside));
}
}
// class BoundsTestCase
$use_sessions = true;
ak_test('BoundsTestCase', $use_sessions);
?>
示例11: array
$this->assertEqual($this->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($this->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($this->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($this->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($this->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($this->url->link_to_unless(true,'Destroy account', array('action' => 'destroy'), array('confirm' => 'Are you sure?'), array('post' => true)),'');
$this->assertEqual($this->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($this->url->_popup_javascript_function('A'),'window.open(this.href);');
$this->assertEqual($this->url->_popup_javascript_function(array('A','B','C')),'window.open(this.href,\'A\',\'C\');');
$this->assertEqual($this->url->_confirm_javascript_function('Are you sure?'),'confirm(\'Are you sure?\')');
$this->assertEqual($this->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($this->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($this->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>');
}
function test_should_encode_utf8_characters_as_entities_when_encoding_mail_to_links()
{
$escaped_iacute = '%26%69%61%63%75%74%65%3b';
$this->assertTrue(strstr($this->url->mail_to('test@example.com', 'mounstro de pulsa aquí', array('encode' => 'javascript')), $escaped_iacute));
}
}
ak_test('UrlHelperTests');
?>
示例12: MockADOConnection
$Mary->friend->add($this->Friend->create(array('name' => 'James')));
//$db = new AkDbAdapter(array()); // no conection details, we're using a Mock
Mock::generate('ADOConnection');
$connection = new MockADOConnection();
$result = new ADORecordSet_array(-1);
$result->InitArray(array(array('id' => 1, 'name' => 'James')), array('id' => 'I', 'name' => 'C'));
$connection->setReturnValue('Execute', $result);
if ($Mary->_db->type() == 'sqlite') {
$connection->expectAt(0, 'Execute', array('SELECT friends.* FROM friends LEFT OUTER JOIN friends_friends AS _FriendFriend ON _FriendFriend.related_id = friends.id LEFT OUTER JOIN friends AS _Friend ON _FriendFriend.friend_id = _Friend.id WHERE (friends.name = ?) AND (_FriendFriend.friend_id LIKE 1) AND 1', array('James')));
} else {
$connection->expectAt(0, 'Execute', array('SELECT friends.* FROM friends LEFT OUTER JOIN friends_friends AS _FriendFriend ON _FriendFriend.related_id = friends.id LEFT OUTER JOIN friends AS _Friend ON _FriendFriend.friend_id = _Friend.id WHERE (friends.name = ?) AND (_FriendFriend.friend_id = 1)', array('James')));
}
$oldConnection = $Mary->_db->connection;
$Mary->_db->connection =& $connection;
//$Mary->_db = $db;
$Mary->friend->find(array('conditions' => array('name = ?', 'James')));
$Mary->_db->connection = $oldConnection;
}
public function test_find_on_association_with_conditions_array()
{
$this->installAndIncludeModels(array('Friend' => 'id,name'));
$Mary =& $this->Friend->create(array('name' => 'Mary'));
$Mary->friend->add($this->Friend->create(array('name' => 'James')));
$Mary->save();
$result = $Mary->friend->find(array('conditions' => array('name = ?', 'James')));
$James = $result[0];
$this->assertEqual($Mary->friends[0]->name, $James->name);
}
}
ak_test('HasAndBelongsToManyTestCase');
示例13: test_find_aa_include_bbs_with_custom_handler_name_return_array
}
public function test_find_aa_include_bbs_with_custom_handler_name_return_array()
{
$aa =& $this->Aa->create(array('name' => 'first aa'));
$this->assertTrue($aa);
$bb1 =& $this->Bb->create(array('name' => 'first bb'));
$bb2 =& $this->Bb->create(array('name' => 'second bb'));
$babies = array($bb1, $bb2);
$aa->babies->set($babies);
$this->assertEqual(2, count($aa->bbs));
/**
* now find them back in order
*/
$found_first_aa = $this->Aa->findFirstBy('name', 'first aa', array('returns' => 'array', 'include' => array('bbs' => array('order' => 'id ASC'))));
$this->assertTrue($found_first_aa);
$this->assertTrue($found_first_aa['bbs']);
$this->assertEqual(2, count($found_first_aa['bbs']));
$this->assertEqual('first bb', $found_first_aa['bbs'][0]['name']);
$this->assertEqual('second bb', $found_first_aa['bbs'][1]['name']);
/**
* now find them back in order and add a condition for the bbs
*/
$found_first_aa = $this->Aa->findFirstBy('name', 'first aa', array('returns' => 'array', 'include' => array('bbs' => array('order' => 'id ASC', 'conditions' => 'name LIKE ?', 'bind' => '%second%'))));
$this->assertTrue($found_first_aa);
$this->assertTrue($found_first_aa['bbs']);
$this->assertEqual(1, count($found_first_aa['bbs']));
$this->assertEqual('second bb', $found_first_aa['bbs'][0]['name']);
}
}
ak_test('test_AkActiveRecord_return_types', true);
示例14: LocationAwareController
$this->failure->city = "(Private Address)";
$this->failure->success = false;
$this->controller = new LocationAwareController();
$this->request = new TestRequest();
# ActionController::TestRequest
$this->response = new TestResponse();
# ActionController::TestResponse
}
// function test_setup
function test_no_location_in_cookie_or_session()
{
# GeoKit::Geocoders::IpGeocoder.expects(:geocode).with("good ip").returns(@success)
# @request.remote_ip = "good ip"
# get :index
# verify
$good_ip = "12.215.42.19";
$ip_geocoder = new IpGeocoder();
$address = $ip_geocoder->geocode($good_ip);
$this->request->remote_ip = $good_ip;
# $response = $this->request->get('body');
#print_r($response);
# $this->assertEqual($response['body'],$this->success);
# $this->verify();
}
}
// class IpGeocodeLookupTestCase
$use_sessions = true;
ak_test('IpGeocodeLookupTestCase', $use_sessions);
?>
示例15: test_should_show_login_with_realm
}
function test_should_show_login_with_realm()
{
$this->setMaximumRedirects(0);
$this->get(AK_TESTING_URL . '/authentication/edit');
$this->assertRealm('App name');
$this->assertNoText("I'm only accessible if you know the password");
}
function test_should_fail_login()
{
$this->setMaximumRedirects(0);
$this->get(AK_TESTING_URL . '/authentication/edit');
$this->authenticate('bermi', 'badpass');
$this->assertResponse(401);
$this->assertNoText("I'm only accessible if you know the password");
}
function test_should_login()
{
$this->setMaximumRedirects(0);
$this->get(AK_TESTING_URL . '/authentication/edit');
$this->authenticate('bermi', 'secret');
$this->assertResponse(200);
$this->assertText("I'm only accessible if you know the password");
// still logged in?
$this->get(AK_TESTING_URL . '/authentication/edit');
$this->assertResponse(200);
$this->assertText("I'm only accessible if you know the password");
}
}
ak_test('_AkActionController_http_authentication');