示例#1
0
 public function test_Should_DeleteExistingProject()
 {
     $arrangedRecipe = Factory::create('App\\Models\\Recipe', ['name' => 'Recipe 1', 'description' => '', 'body' => '']);
     $arrangedServer = Factory::create('App\\Models\\Server', ['name' => 'Recipe 1', 'description' => '', 'body' => '']);
     $arrangedProject = Factory::create('App\\Models\\Project', ['name' => 'Project 1', 'server_id' => $arrangedServer->id, 'stage' => 'staging']);
     $arrangedProject->recipes()->sync([$arrangedRecipe->id => ['recipe_order' => 1]]);
     $projectRepository = new EloquentProject(new App\Models\Project(), new App\Models\MaxDeployment());
     $projectRepository->delete($arrangedProject->id);
     $project = new App\Models\Project();
     $deletedProject = $project->find($arrangedProject->id);
     $this->assertNull($deletedProject);
     $updatedProjectRecipes = $arrangedProject->recipes;
     $this->assertEmpty($updatedProjectRecipes);
 }
示例#2
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
// Provide controller methods with object instead of ID
Route::model('tasks', 'Task');
Route::model('projects', 'Project');
// Use slugs rather than IDs in URLs
Route::bind('tasks', function ($value, $route) {
    return App\Models\Task::whereSlug($value)->first();
});
Route::bind('projects', function ($value, $route) {
    return App\Models\Project::whereSlug($value)->first();
});
Route::resource('/', 'ProjectsController');
Route::resource('projects', 'ProjectsController');
Route::resource('projects.tasks', 'TasksController');
示例#3
-1
<?php

//THIS FILE MUST NOT BE AVAILABLE IN PRODUCTION SYSTEMS!!!!
require __DIR__ . '/../vendor/autoload.php';
$database = new Slim\PDO\Database('mysql:host=localhost;dbname=projectist;charset=utf8', 'root', '');
$project_names = array('Inotice', 'Dongstrip', 'Overtaxon', 'Stattex', 'Stanhow', 'Sansailcity', 'Aceredcode', 'viaware', 'Sonla', 'Codefax', 'Goodfix', 'Transfase', 'unazoom', 'Canenix', 'X-zim', 'Bamdrill', 'Zoo-code', 'Medlane', 'Dingmedfax', 'zathcane', 'K-zone', 'Dan-ex', 'Unifinfan', 'Suntrans', 'Y-ex', 'zimla', 'Over-city', 'Doubleware', 'Plusing', 'templine', 'Geolex', 'Yearhex', 'Hatgofase', 'Stat-con', 'Media-tex', 'Redtom', 'J-tancore');
$sql = "TRUNCATE TABLE projects";
$database->exec($sql);
echo "Truncating the projects Table<br>";
foreach ($project_names as $project_name) {
    //insert some projects
    $project = new \App\Models\Project($database);
    $project->CreateNew('code_test2', $project_name, 'owner_test', 'portfolio_test', 'rag_status_test');
    $project->Save();
    $project = null;
    echo "saved Project {$project_name} <br>";
}