mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX Allow quotes in expected ReflectionExceptions within tests
This commit is contained in:
parent
44685eceba
commit
f1c94e6d54
@ -3,6 +3,7 @@
|
|||||||
namespace SilverStripe\Core\Injector;
|
namespace SilverStripe\Core\Injector;
|
||||||
|
|
||||||
use Psr\Container\NotFoundExceptionInterface;
|
use Psr\Container\NotFoundExceptionInterface;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
class InjectorNotFoundException extends \Exception implements NotFoundExceptionInterface
|
class InjectorNotFoundException extends \Exception implements NotFoundExceptionInterface
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,7 @@ class ClassInfoTest extends SapphireTest
|
|||||||
public function testNonClassName()
|
public function testNonClassName()
|
||||||
{
|
{
|
||||||
$this->expectException(ReflectionException::class);
|
$this->expectException(ReflectionException::class);
|
||||||
$this->expectExceptionMessage('Class IAmAClassThatDoesNotExist does not exist');
|
$this->expectExceptionMessageRegExp('/Class "?IAmAClassThatDoesNotExist"? does not exist/');
|
||||||
$this->assertEquals('IAmAClassThatDoesNotExist', ClassInfo::class_name('IAmAClassThatDoesNotExist'));
|
$this->assertEquals('IAmAClassThatDoesNotExist', ClassInfo::class_name('IAmAClassThatDoesNotExist'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ namespace SilverStripe\ORM\Tests;
|
|||||||
|
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use SilverStripe\Core\Convert;
|
use SilverStripe\Core\Convert;
|
||||||
|
use SilverStripe\Core\Injector\InjectorNotFoundException;
|
||||||
use SilverStripe\Dev\SapphireTest;
|
use SilverStripe\Dev\SapphireTest;
|
||||||
use SilverStripe\ORM\DataList;
|
use SilverStripe\ORM\DataList;
|
||||||
use SilverStripe\ORM\DataQuery;
|
use SilverStripe\ORM\DataQuery;
|
||||||
@ -751,24 +752,23 @@ class DataListTest extends SapphireTest
|
|||||||
$this->assertEquals('Bob', $list->first()->Name, 'First comment should be from Bob');
|
$this->assertEquals('Bob', $list->first()->Name, 'First comment should be from Bob');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @expectedException \SilverStripe\Core\Injector\InjectorNotFoundException
|
|
||||||
* @expectedExceptionMessage Class DataListFilter.Bogus does not exist
|
|
||||||
*/
|
|
||||||
public function testSimpleFilterWithNonExistingComparisator()
|
public function testSimpleFilterWithNonExistingComparisator()
|
||||||
{
|
{
|
||||||
|
$this->expectException(InjectorNotFoundException::class);
|
||||||
|
$this->expectExceptionMessageRegExp('/Class "?DataListFilter.Bogus"? does not exist/');
|
||||||
|
|
||||||
$list = TeamComment::get();
|
$list = TeamComment::get();
|
||||||
$list->filter('Comment:Bogus', 'team comment');
|
$list->filter('Comment:Bogus', 'team comment');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invalid modifiers are treated as failed filter construction
|
* Invalid modifiers are treated as failed filter construction
|
||||||
*
|
|
||||||
* @expectedException \SilverStripe\Core\Injector\InjectorNotFoundException
|
|
||||||
* @expectedExceptionMessage Class DataListFilter.invalidmodifier does not exist
|
|
||||||
*/
|
*/
|
||||||
public function testInvalidModifier()
|
public function testInvalidModifier()
|
||||||
{
|
{
|
||||||
|
$this->expectException(InjectorNotFoundException::class);
|
||||||
|
$this->expectExceptionMessageRegExp('/Class "?DataListFilter.invalidmodifier"? does not exist/');
|
||||||
|
|
||||||
$list = TeamComment::get();
|
$list = TeamComment::get();
|
||||||
$list->filter('Comment:invalidmodifier', 'team comment');
|
$list->filter('Comment:invalidmodifier', 'team comment');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user