/** * add multiple records at once * * @depends testDomainWasCreated */ function testAddMultipleRecords() { // sleep for atleast one second between methods, it is only 'eventual consistency' sleep(1); // build some test data $data_array = array(); foreach (range('a', 'z') as $letter) { $data_array[$letter] = array('letter_position' => zero_pad(count($data_array), 2)); } $result = SimpleDB::setMultiple($this->test_domain, $data_array); $this->assertTrue($result); }
function seconds_to_time($time, $seconds_only = '') { $seconds = $time % 60; if ($time > 60) { $time /= 60; $minutes = $time % 60; if ($time > 60) { $time /= 60; $hours = $time % 24; if ($time > 24) { $time /= 24; $days = $time % 365; if ($time > 365) { $time /= 365; $years = floor($time); } } } } if (!empty($years)) { $return = $years . ' years'; } if (!empty($days)) { $return .= (!empty($return) ? ', ' : '') . $days . ' days'; } $return .= (!empty($return) ? ', ' : '') . (!empty($hours) ? $hours . ':' : (!empty($return) ? '0:' : '')); $return .= !empty($minutes) ? $minutes . ':' : (!empty($return) ? '00:' : ''); $return .= !empty($return) ? zero_pad($seconds) : $seconds . (!empty($seconds) ? $seconds_only : ''); return $return; }
</form> </div> <ul> <?$size = $curElementLocation->season_size;for($i = 0; $i < $size; $i++):?> <li class="episode" id="<?php echo $curLocation->name; ?> _<?php echo $curElementLocation->season; ?> _<?php echo $i; ?> "> <?if($curElementLocation->season != 0):?><span class="absolute_number"><?echo zero_pad($absolute_number,3);$absolute_number++;?></span><?endif?><span class="episode_number">e<?$curEp = $i+$curElementLocation->episode_start; echo zero_pad($curEp,2)?></span> </li> <?endfor?> </ul> </li> <?endforeach?> <li> <?if($logedIn):?> <div class="newSeason"> <?php echo form_open("xem/newSeason"); ?> <?php echo form_hidden("element_id", $fullelement->id);
public function test_zero_pad() { $this->assertEquals(zero_pad(12, 4), '0012'); }