-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from jsirish/tests/psr2cleanup
quick psr-2 cleanup
- Loading branch information
Showing
3 changed files
with
91 additions
and
93 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
<?php | ||
|
||
class FlexSliderTest extends FunctionalTest{ | ||
class FlexSliderTest extends FunctionalTest | ||
{ | ||
protected static $fixture_file = 'flexslider/tests/FlexSliderTest.yml'; | ||
protected static $disable_themes = true; | ||
protected static $use_draft_site = false; | ||
|
||
protected static $fixture_file = 'flexslider/tests/FlexSliderTest.yml'; | ||
protected static $disable_themes = true; | ||
protected static $use_draft_site = false; | ||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
|
||
public function setUp(){ | ||
parent::setUp(); | ||
ini_set('display_errors', 1); | ||
ini_set('log_errors', 1); | ||
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED); | ||
} | ||
|
||
ini_set('display_errors', 1); | ||
ini_set("log_errors", 1); | ||
error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED); | ||
} | ||
|
||
public function logOut(){ | ||
$this->session()->clear('loggedInAs'); | ||
$this->session()->clear('logInWithPermission'); | ||
} | ||
|
||
public function testFlexSlider(){} | ||
public function logOut() | ||
{ | ||
$this->session()->clear('loggedInAs'); | ||
$this->session()->clear('logInWithPermission'); | ||
} | ||
|
||
public function testFlexSlider() | ||
{ | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,64 @@ | ||
<?php | ||
|
||
class SlideImageTest extends FlexSliderTest{ | ||
class SlideImageTest extends FlexSliderTest | ||
{ | ||
protected static $use_draft_site = true; | ||
|
||
protected static $use_draft_site = true; | ||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
} | ||
|
||
function setUp(){ | ||
parent::setUp(); | ||
} | ||
public function testSlideImageCreation() | ||
{ | ||
$this->logInWithPermission('Slide_CREATE'); | ||
$slide = $this->objFromFixture('SlideImage', 'slide1'); | ||
|
||
function testSlideImageCreation(){ | ||
$this->assertTrue($slide->canCreate()); | ||
|
||
$this->logInWithPermission('Slide_CREATE'); | ||
$slide = $this->objFromFixture('SlideImage', 'slide1'); | ||
$slideID = $slide->ID; | ||
|
||
$this->assertTrue($slide->canCreate()); | ||
$this->assertTrue($slideID > 0); | ||
|
||
$slideID = $slide->ID; | ||
$getSlide = SlideImage::get()->byID($slideID); | ||
$this->assertTrue($getSlide->ID == $slideID); | ||
} | ||
|
||
$this->assertTrue($slideID > 0); | ||
public function testSlideUpdate() | ||
{ | ||
$this->logInWithPermission('ADMIN'); | ||
$slide = $this->objFromFixture('SlideImage', 'slide1'); | ||
$slideID = $slide->ID; | ||
|
||
$getSlide = SlideImage::get()->byID($slideID); | ||
$this->assertTrue($getSlide->ID == $slideID); | ||
$image = $this->objFromFixture('Image', 'image1'); | ||
$imageID = $image->ID; | ||
|
||
} | ||
$this->logOut(); | ||
|
||
function testSlideUpdate(){ | ||
$this->logInWithPermission('Slide_EDIT'); | ||
|
||
$this->logInWithPermission('ADMIN'); | ||
$slide = $this->objFromFixture('SlideImage', 'slide1'); | ||
$slideID = $slide->ID; | ||
$this->assertTrue($slide->canEdit()); | ||
$slide = SlideImage::get()->byID($slideID); | ||
$newTitle = 'Updated Name for Slide'; | ||
$slide->Name = $newTitle; | ||
$slide->ImageID = $imageID; | ||
$slide->write(); | ||
|
||
$image = $this->objFromFixture('Image', 'image1'); | ||
$imageID = $image->ID; | ||
$slide = SlideImage::get()->byiD($slideID); | ||
|
||
$this->logOut(); | ||
$this->assertTrue($slide->Name == $newTitle); | ||
} | ||
|
||
$this->logInWithPermission('Slide_EDIT'); | ||
|
||
$this->assertTrue($slide->canEdit()); | ||
$slide = SlideImage::get()->byID($slideID); | ||
$newTitle = "Updated Name for Slide"; | ||
$slide->Name = $newTitle; | ||
$slide->ImageID = $imageID; | ||
$slide->write(); | ||
|
||
$slide = SlideImage::get()->byiD($slideID); | ||
|
||
$this->assertTrue($slide->Name == $newTitle); | ||
|
||
} | ||
|
||
function testSlideImageDeletion(){ | ||
|
||
$this->logInWithPermission('Slide_DELETE'); | ||
$slide = $this->objFromFixture('SlideImage', 'slide2'); | ||
$slideID = $slide->ID; | ||
|
||
$this->assertTrue($slide->canDelete()); | ||
$slide->delete(); | ||
|
||
$slides = SlideImage::get()->column('ID'); | ||
$this->assertFalse(in_array($slideID, $slides)); | ||
|
||
} | ||
public function testSlideImageDeletion() | ||
{ | ||
$this->logInWithPermission('Slide_DELETE'); | ||
$slide = $this->objFromFixture('SlideImage', 'slide2'); | ||
$slideID = $slide->ID; | ||
|
||
$this->assertTrue($slide->canDelete()); | ||
$slide->delete(); | ||
|
||
$slides = SlideImage::get()->column('ID'); | ||
$this->assertFalse(in_array($slideID, $slides)); | ||
} | ||
} |