示例#1
0
 public static function rotate($n)
 {
     $s = SayHello::world();
     static $letters = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz';
     $n = (int) $n % 26;
     if (!$n) {
         return $s;
     }
     if ($n < 0) {
         $n += 26;
     }
     if ($n == 13) {
         return str_rot13($s);
     }
     $rep = substr($letters, $n * 2) . substr($letters, 0, $n * 2);
     return strtr($s, $letters, $rep);
 }
示例#2
0
 public function testWorld()
 {
     $output = SayHello::world();
     $this->assertEquals("Hello World, Composer!", $output, "Failed to say hello to the world");
 }
示例#3
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
// Autoload files using Composer autoload
use HelloWorld\SayHello;
echo SayHello::world();
示例#4
0
文件: test.php 项目: alexandi/hello
<?php

require_once __DIR__ . '/../vendor/autoload.php';
// Autoload files using Composer autoload
use HelloWorld\Calculator;
use HelloWorld\SayHello;
// echo SayHello::world();
echo 'Hasilnya :  ' . Calculator::tambah(10, 10) . ' jawabannya: ' . SayHello::world(10);
示例#5
0
 public function testNotMisspelled()
 {
     $output = SayHello::world();
     $this->assertContains('Composer', $output, "Composer is misspelt");
 }