Example #1
0
 public function testUserCreate()
 {
     $userProxy = test::double('User', ['save' => function () {
         echo "MOCKED User->save() called\n";
     }]);
     $service = new UserService();
     $user = $service->createUserByName('Zachary');
     $this->assertEquals('Zachary', $user->getName());
     $userProxy->verifyInvoked('save');
 }
Example #2
0
<?php

$app = Application::init();
$app->route()->get('/', function () {
    $name = Request::get('name', 'jm-factorin');
    $user = UserService::createUserByName($name);
    return View::render('default.index', array('name' => $user->name));
});