Skip to content

Commit

Permalink
coverage(projects): edit when owner
Browse files Browse the repository at this point in the history
  • Loading branch information
fxleblanc committed Apr 1, 2016
1 parent b186e30 commit aba4f4e
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/Fixture/OrganizationsFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,14 @@ class OrganizationsFixture extends TestFixture
'isValidated' => 1,
'isRejected' => 1
],
[
'id' => 4,
'name' => 'Org4',
'website' => 'www.website.com',
'logo' => '/img/logo.jpg',
'description' => 'Awesome',
'isValidated' => 1,
'isRejected' => 0
],
];
}
5 changes: 5 additions & 0 deletions tests/Fixture/OrganizationsOwnersFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ class OrganizationsOwnersFixture extends TestFixture
'id' => 4,
'organization_id' => 1,
'user_id' => 4
],
[
'id' => 5,
'organization_id' => 4,
'user_id' => 14
]
];
}
5 changes: 5 additions & 0 deletions tests/Fixture/OrganizationsProjectsFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,10 @@ class OrganizationsProjectsFixture extends TestFixture
'project_id' => 1,
'organization_id' => 1
],
[
'id' => 2,
'project_id' => 6,
'organization_id' => 4
]
];
}
5 changes: 5 additions & 0 deletions tests/Fixture/PermissionsTypeUsersFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,5 +344,10 @@ class PermissionsTypeUsersFixture extends TestFixture
'type_user_id' => 3,
'permission_id' => 46
],
[
'id' => 63,
'type_user_id' => 5,
'permission_id' => 11
]
];
}
8 changes: 8 additions & 0 deletions tests/Fixture/ProjectsFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ class ProjectsFixture extends TestFixture
'description' => 'bla bla',
'accepted' => 0,
'archived' => 1
],
[
'id' => 6,
'name' => 'projet6',
'link' => 'www.website.com',
'description' => 'bla bla',
'accepted' => 1,
'archived' => 0
]
];
}
5 changes: 5 additions & 0 deletions tests/Fixture/TypeUsersUsersFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,10 @@ class TypeUsersUsersFixture extends TestFixture
'type_user_id' => 4,
'user_id' => 4
],
[
'id' => 6,
'type_user_id' => 5,
'user_id' => 14
],
];
}
24 changes: 24 additions & 0 deletions tests/Fixture/UsersFixture.php
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,30 @@ class UsersFixture extends TestFixture
'interest' => 'Un petit interet.',
'isProfessor' => 0,
'language' => 0
],
[
'id' => 14,
'firstName' => 'Owner',
'lastName' => 'Org4',
'biography' => 'Une petite bio.',
'portfolio' => 'http://monportfolio.com',
'email' => 'email@gmail.com',
'phone' => '(514) 777-7777',
'gender' => null,
'password' => '$2y$10$6DYQvHVFPlT06jcE7UbRfeFSkBt2zdMjnk8nMDnVQDUI32819Y5O.', //toto
'username' => 'org4Owner',
'university_id' => 0,
'isAvailableMentoring' => 1,
'isStudent' => 0,
'mailingList' => 0,
'twitter' => 'http://montwitter.com',
'facebook' => 'http://monfacebook.com',
'googlePlus' => 'http://mongoogleplus.com',
'linkedIn' => 'http://monlinkedin.com',
'emailPublic' => 'email@gmail.com',
'interest' => 'Un petit interet.',
'isProfessor' => 0,
'language' => 0
]
];
}
18 changes: 18 additions & 0 deletions tests/TestCase/Controller/ProjectsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class ProjectsControllerTest extends IntegrationTestCase
'app.organizations_Projects',
'app.users',
'app.type_users',
'app.type_missions',
'app.svn_users',
'app.svns',
'app.universities',
Expand Down Expand Up @@ -626,4 +627,21 @@ public function testViewNotAccepted()

$this->assertRedirect(['action' => 'index']);
}

/**
* Test edit when not administrator
*
* @return void
*/
public function testEditNotAdmin()
{
$userId = 14;
$projectId = 6;

$this->session(['Auth.User.id' => $userId]);

$this->get('/projects/edit/' . $projectId);

$this->assertResponseSuccess();
}
}

0 comments on commit aba4f4e

Please sign in to comment.