public function install($version = null, $options = array()) { $this->createTable('dummy_posts', 'id, title, body, hip_factor int, comments_count, posted_on, expires_at'); $this->createTable('dummy_comments', 'id,name,body,dummy_post_id,created_at'); $DummyPost = new DummyPost(); $Post = $DummyPost->create(array('title' => 'One', 'body' => 'First post')); foreach (range(1, 5) as $n) { $Post->dummy_comment->add(new DummyComment(array('body' => AkInflector::ordinalize($n) . ' post'))); } $Post->save(); }
public function test_setup() { $TestSetup = new AkUnitTest(); $TestSetup->installAndIncludeModels(array('Post', 'Comment', 'Tag')); $Post =& $TestSetup->Post->create(array('title' => 'One', 'body' => 'First post')); foreach (range(1, 5) as $n) { $Post->comment->add(new Comment(array('body' => AkInflector::ordinalize($n) . ' post'))); } $Post->save(); $Post->reload(); $Post->comment->load(); $this->assertEqual($Post->comment->count(), 5); $this->post_id = $Post->id; }
function _getDocumentationForMethod($ApiMethod) { $doc = !empty($ApiMethod->documentation) ? $ApiMethod->documentation . "\n" : ''; foreach (array('expects', 'returns') as $expects_or_returns) { if (!empty($ApiMethod->{$expects_or_returns})) { foreach ($ApiMethod->{$expects_or_returns} as $k => $type) { $doc .= "\n" . ($expects_or_returns == 'expects' ? Ak::t(AkInflector::ordinalize($k + 1)) . ' parameter as' : 'Returns') . " {$type}:"; if (!empty($ApiMethod->{$expects_or_returns . '_documentation'}[$k])) { $doc .= ' ' . $ApiMethod->{$expects_or_returns . '_documentation'}[$k]; } } } } return $doc; }
public function ordinalize() { return AkInflector::ordinalize($this->value); }
function Test_of_ordinalize() { foreach ($this->OrdinalNumbers as $number => $ordinalized) { $this->assertEqual($ordinalized, AkInflector::ordinalize($number)); } }