This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Replaces tokens in distribution files. | |
*/ | |
class CI_Task_ConfigureDistTask extends sfBaseTask | |
{ | |
/** | |
* @see sfTask | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void save() { | |
running(fakeApplication(), new Runnable() { | |
public void run() { | |
// Here is your real test code | |
Company company = new Company("My Company"); | |
company.save(); | |
assertThat(company.id).isNotNull(); | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BaseModelTest { | |
public static FakeApplication app; | |
@BeforeClass | |
public static void startApp() { | |
app = Helpers.fakeApplication(Helpers.inMemoryDatabase()); | |
Helpers.start(app); | |
} | |
@AfterClass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BaseModelTest { | |
public static FakeApplication app; | |
public static String createDdl = ""; | |
public static String dropDdl = ""; | |
@BeforeClass | |
public static void startApp() throws IOException { | |
app = Helpers.fakeApplication(Helpers.inMemoryDatabase()); | |
Helpers.start(app); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Application extends Controller { | |
public static Result testText() { | |
return ok("Hello world !"); | |
} | |
public static Result testTemplate() { | |
return ok(index.render("Your new application is ready.")); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@(user: User, links : List[link]) | |
@main("User links") { | |
<p>Welcome @user.name !</p> | |
<ul> | |
@for(link <- links) { | |
<li><a href="@link.url">@link.title</a></li> | |
} | |
</ul> | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
public class Company extends Model { | |
@Id | |
public Long id; | |
@Constraints.Required | |
public String name; | |
public Company(String name) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class User(email: String, name: String, password: String) | |
object User { | |
// -- Parsers | |
/** | |
* Parse a User from a ResultSet | |
*/ | |
val simple = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_module_form_alter(&$form, $form_state, $form_id) { | |
if ($form_id == 'page_node_form' && !user_access('administer content')) { | |
// Alter node edit form | |
$menu_items = $form['menu']['link']['parent']['#options']; | |
$menu_items_to_delete = array(); | |
$workbench_access_menus = workbench_access_get_user_tree(); | |
foreach ($menu_items as $menu_key => $menu_value) { | |
$ok = false; | |
foreach ($workbench_access_menus as $id => $workbench_access_menu) { |
OlderNewer