public function testXXX() { $expectedResult = "Hello, somkiat"; $hello = new Hello(); $actualResult = $hello->sayHi("somkiat"); $this->assertEquals($expectedResult, $actualResult); }
/** * @magentoDataFixture Magento/Customer/_files/customer.php */ public function testToHtml() { $this->customerSession->setCustomerId(1); $html = $this->block->toHtml(); $this->assertContains("<div class=\"block block-dashboard-welcome\">", $html); $this->assertContains("<strong>Hello, Firstname Lastname!</strong>", $html); }
public static function getid() { self::$subjectid = self::$subjectid + 1; echo self::$subjectid; }
<?php namespace Com\Iesebres\Dam2\spineda\helloworldcomposer; require __DIR__ . "/src/Hello.php"; $greetings = new Hello(); $greetings->say_Hello();
public function testRunMethod() { $hello = new Hello(); $this->assertEquals("Hello Composer", $hello->run()); }
<?php require '../src/Hello.php'; $hello = new Hello(); print $hello->greet();
<?php class Hello { public static $greeting = 'hello'; public static function hello_world() { print self::$greeting . " world!\n"; } } Hello::hello_world();
<?php //require "Hello.php"; require __DIR__ . "/Hello.php"; $greetings = new Hello(); $greetings->sayHello();
<?php require __DIR__ . "/src/hello.php"; use Com\Iesebre\Dam2\rogermelich\helloworldComposer\hello; /** * Created by PhpStorm. * User: roger * Date: 6/10/15 * Time: 19:33 */ $greatings = new Hello(); $greatings->sayHello();
public function actionIndex() { $data = Hello::model()->findAll(); $this->render('index', array('data' => $data)); }
<?php include "Hello.php"; $a = new Hello(); $a->bj(); ?>
<?php $br = php_sapi_name() == "cli" ? "" : "<br>"; if (!extension_loaded('objects2')) { dl('objects2.' . PHP_SHLIB_SUFFIX); } $obj = new Hello("leon", 32); echo $obj->greet(); echo $obj->var;
public function setAge($age) { if ($this->chain == FALSE) { return $this->name = $age; } else { $this->name = $age; return $this; } } public function introduce() { if (empty($this->name)) { print "I need a name!"; } else { if (empty($this->age)) { print "I dont have an age!"; } else { printf("Hello there, my name is <b>%s</b> and I am <b>%s</b> years old.", $this->name, $this->age); } } } } //$hello = new Hello(); $name = "Tung"; $age = 17; //echo $hello->setName($name); //echo $hello->setAge($age); //$hello->introduce(); $hello = new Hello(true); // chaining method $hello->setName($name)->setAge($age)->introduce();
public function getMessage() { return parent::getMessage() . ", World"; }
<?php // Define project specific routes using $app which is an instance of Slim /* For example: $app->get('/foo/bar', function($request, $response, $args) { $controller = new \Project\Controllers\Index($this, $request, $response); return $controller->index(); }); */ if (!S3MVC_APP_USE_MVC_ROUTES) { //Not using mvc routes. So at least define the default / route. //You can change it for your app if desired $app->get('/', function ($request, $response, $args) { $prepend_action = !S3MVC_APP_AUTO_PREPEND_ACTION_TO_ACTION_METHOD_NAMES; $action = $prepend_action ? 'action-index' : 'index'; $controller = new Hello($this, 'hello', $action); return $controller->actionIndex(); }); }
<?php require_once "lib/Core.php"; require_once "obj/Hello.php"; // インスタンス生成 $obj = new Hello(); // Hello World!! $obj->sayHello();
<?php /** * Created by PhpStorm. * User: jim * Date: 2015/11/5 * Time: 22:54 */ require_once 'hello1.php'; $h = new Hello(); $h->sayHello(); $d = new Desktop(); $d->work();
public function tell() { Hello::say(); }
<?php $c = new Hello(); echo $c->getName(), PHP_EOL; echo Hello::DefaultHello(), PHP_EOL;
<?php class Hello { protected $lang; function __construct($lang) { $this->lang = $lang; } function greet() { if ($this->lang == 'fr') { return 'Bonjour'; } if ($this->lang == 'es') { return 'Hola'; } return 'Hello'; } } $hi = new Hello('es'); echo $hi->greet() . "\n";
public function index() { $message = Hello::getMessage(); $this->set(get_defined_vars()); }
private function __construct($name, $option = null) { self::$name = $name; }