Skip to content
This repository has been archived by the owner on Jan 31, 2020. It is now read-only.

Commit

Permalink
Merge branch 'remove-tests-catch-fail' of https://github.com/Maks3w/zf2
Browse files Browse the repository at this point in the history
… into hotfix/tests-exceptions
  • Loading branch information
weierophinney committed Jul 5, 2012
5 parents 8d0d624 + 7226b1d + 851904c + a2eb795 + 7e0fd1f commit 7fe4493
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 31 deletions.
8 changes: 3 additions & 5 deletions test/Helper/HeadScriptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,11 +357,9 @@ public function testCanPerformMultipleSerialCaptures()
$this->helper->__invoke()->captureStart();
echo "this is something captured";
$this->helper->__invoke()->captureEnd();
try {
$this->helper->__invoke()->captureStart();
} catch (View\Exception\ExceptionInterface $e) {
$this->fail('Serial captures should be allowed');
}

$this->helper->__invoke()->captureStart();

echo "this is something else captured";
$this->helper->__invoke()->captureEnd();
}
Expand Down
7 changes: 2 additions & 5 deletions test/Helper/HeadStyleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,8 @@ public function testSerialCapturingWorks()
echo "Captured text";
$this->helper->__invoke()->captureEnd();

try {
$this->helper->__invoke()->captureStart();
} catch (View\Exception\ExceptionInterface $e) {
$this->fail('Serial capturing should work');
}
$this->helper->__invoke()->captureStart();

$this->helper->__invoke()->captureEnd();
}

Expand Down
23 changes: 7 additions & 16 deletions test/Helper/PaginationControlTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,7 @@ public function testUsesPaginatorFromViewIfNoneSupplied()
$this->_viewHelper->getView()->paginator = $this->_paginator;
Helper\PaginationControl::setDefaultViewPartial('testPagination.phtml');

try {
$output = $this->_viewHelper->__invoke();
} catch (\Zend\View\Exception\ExceptionInterface $e) {
$this->fail('Could not find paginator in the view instance');
}
$output = $this->_viewHelper->__invoke();

$this->assertContains('pagination control', $output, $output);
}
Expand All @@ -147,12 +143,11 @@ public function testThrowsExceptionIfNoPaginatorFound()
{
Helper\PaginationControl::setDefaultViewPartial('testPagination.phtml');

try {
$output = $this->_viewHelper->__invoke();
} catch (\Exception $e) {
$this->assertInstanceOf('Zend\View\Exception\ExceptionInterface', $e);
$this->assertEquals('No paginator instance provided or incorrect type', $e->getMessage());
}
$this->setExpectedException(
'Zend\View\Exception\ExceptionInterface',
'No paginator instance provided or incorrect type'
);
$this->_viewHelper->__invoke();
}

/**
Expand Down Expand Up @@ -191,11 +186,7 @@ public function testCanUseObjectForScrollingStyle()
{
$all = new Paginator\ScrollingStyle\All();

try {
$output = $this->_viewHelper->__invoke($this->_paginator, $all, 'testPagination.phtml');
} catch (\Exception $e) {
$this->fail('Could not use object for sliding style');
}
$output = $this->_viewHelper->__invoke($this->_paginator, $all, 'testPagination.phtml');

$this->assertContains('page count (11) equals pages in range (11)', $output, $output);
}
Expand Down
6 changes: 1 addition & 5 deletions test/Helper/PartialLoopTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,11 +252,7 @@ public function testEmptyArrayPassedToPartialLoopShouldNotThrowException()
$view->resolver()->addPath($this->basePath . '/application/views/scripts');
$this->helper->setView($view);

try {
$result = $this->helper->__invoke('partialLoop.phtml', array());
} catch (\Exception $e) {
$this->fail('Empty array should not cause partialLoop to throw exception');
}
$this->helper->__invoke('partialLoop.phtml', array());
}

/**
Expand Down

0 comments on commit 7fe4493

Please sign in to comment.