public function testNameUppercased() { $output = SayHello::name('steve johnson'); $this->assertContains("Steve", $output); $this->assertNotContains("steve", $output); $this->assertContains("Johnson", $output); $this->assertNotContains("johnson", $output); }
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); }
public function testReturnObject() { $this->assertInstanceOf('\\HelloWorld\\SayHello', SayHello::returnObject()); }
<?php require_once __DIR__ . '/../vendor/autoload.php'; // Autoload files using Composer autoload use HelloWorld\SayHello; echo SayHello::world();
<?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);
public function testWorld() { $output = SayHello::world(); $this->assertEquals("Hello Composer!", $output, "Failed to say hello to the world"); }
public function testNotMisspelled() { $output = SayHello::world(); $this->assertContains('Composer', $output, "Composer is misspelt"); }
<?php require 'vendor/autoload.php'; use HelloWorld\SayHello; echo SayHello::world(); echo "<br/>" . print_r(SayHello::getColors(), true);