mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Update exception assertions in tests and remove deprecated annotations
This commit is contained in:
parent
27bd5d12e3
commit
ae1e17edec
@ -432,7 +432,7 @@ abstract class Database
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
throw new \InvalidArgumentException(
|
throw new \InvalidArgumentException(
|
||||||
"SS_Database::manipulate() Can't recognise command '{$writeInfo['command']}'",
|
"SS_Database::manipulate() Can't recognise command '{$writeInfo['command']}'"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,11 +160,9 @@ class HTTPRequestTest extends SapphireTest
|
|||||||
$this->assertEquals($expected, $actual);
|
$this->assertEquals($expected, $actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
*/
|
|
||||||
public function testBadDetectMethod()
|
public function testBadDetectMethod()
|
||||||
{
|
{
|
||||||
|
$this->expectException(\InvalidArgumentException::class);
|
||||||
HTTPRequest::detect_method('POST', ['_method' => 'Boom']);
|
HTTPRequest::detect_method('POST', ['_method' => 'Boom']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,11 +189,9 @@ class HTTPRequestTest extends SapphireTest
|
|||||||
$this->assertEquals($request, $returnedRequest);
|
$this->assertEquals($request, $returnedRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
*/
|
|
||||||
public function testBadSetHttpMethod()
|
public function testBadSetHttpMethod()
|
||||||
{
|
{
|
||||||
|
$this->expectException(\InvalidArgumentException::class);
|
||||||
$request = new HTTPRequest('GET', '/hello');
|
$request = new HTTPRequest('GET', '/hello');
|
||||||
$request->setHttpMethod('boom');
|
$request->setHttpMethod('boom');
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace SilverStripe\Forms\Tests;
|
namespace SilverStripe\Forms\Tests;
|
||||||
|
|
||||||
use PHPUnit_Framework_Error;
|
|
||||||
use SilverStripe\Dev\CSSContentParser;
|
use SilverStripe\Dev\CSSContentParser;
|
||||||
use SilverStripe\Dev\SapphireTest;
|
use SilverStripe\Dev\SapphireTest;
|
||||||
use SilverStripe\Forms\CompositeField;
|
use SilverStripe\Forms\CompositeField;
|
||||||
@ -161,12 +160,13 @@ class CompositeFieldTest extends SapphireTest
|
|||||||
$this->assertNull($result['title']);
|
$this->assertNull($result['title']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @expectedException PHPUnit_Framework_Error
|
|
||||||
* @expectedExceptionMessageRegExp /a field called 'Test' appears twice in your form.*TextField.*TextField/
|
|
||||||
*/
|
|
||||||
public function testCollateDataFieldsThrowsErrorOnDuplicateChildren()
|
public function testCollateDataFieldsThrowsErrorOnDuplicateChildren()
|
||||||
{
|
{
|
||||||
|
$this->expectException(\RuntimeException::class);
|
||||||
|
$this->expectExceptionMessageRegExp(
|
||||||
|
"/a field called 'Test' appears twice in your form.*TextField.*TextField/"
|
||||||
|
);
|
||||||
|
|
||||||
$field = CompositeField::create(
|
$field = CompositeField::create(
|
||||||
TextField::create('Test'),
|
TextField::create('Test'),
|
||||||
TextField::create('Test')
|
TextField::create('Test')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user