Skip to content

Instantly share code, notes, and snippets.

View nibra's full-sized avatar

Niels Braczek nibra

  • Braczek Software- und DatenSysteme
  • Germany
View GitHub Profile
<?php
/**
* @package Joomla.UnitTest
*
* @copyright Copyright (C) 2005 - 2018 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace Joomla\UnitTest\CMS\Console;
@nibra
nibra / ExceptionTest.php
Created October 30, 2015 12:20
Minimal test to demonstrate the exception problem. PHP throws an Exception on typehint violations.
<?php
class ExceptionTest extends PHPUnit_Framework_TestCase
{
public function foo(StdClass $class)
{}
public function testException()
{
$this->setExpectedException('Exception');
$this->foo(new ArrayObject);
@nibra
nibra / CodeCeption-Exception
Created October 30, 2015 11:59
Example for non-working exception capture in CodeCeption
// Works:
/**
* Tests the setDbo method with the wrong type of class.
*/
public function testSetDboWithBadInput()
{
if (PHP_MAJOR_VERSION >= 7)
{
$this->markTestSkipped('A fatal error is thrown on PHP 7 due to the typehinting of the method.');