$status->warning( 'fooBar!' );
$testCases['1StringWarning'] = [
$status,
- "<fooBar!>",
+ "⧼fooBar!⧽",
"(wrap-short: (fooBar!))",
- "<p><fooBar!>\n</p>",
+ "<p>⧼fooBar!⧽\n</p>",
"<p>(wrap-short: (fooBar!))\n</p>",
];
$status->warning( 'fooBar2!' );
$testCases['2StringWarnings'] = [
$status,
- "* <fooBar!>\n* <fooBar2!>\n",
+ "* ⧼fooBar!⧽\n* ⧼fooBar2!⧽\n",
"(wrap-long: * (fooBar!)\n* (fooBar2!)\n)",
- "<ul><li> <fooBar!></li>\n<li> <fooBar2!></li></ul>\n",
+ "<ul><li> ⧼fooBar!⧽</li>\n<li> ⧼fooBar2!⧽</li></ul>\n",
"<p>(wrap-long: * (fooBar!)\n</p>\n<ul><li> (fooBar2!)</li></ul>\n<p>)\n</p>",
];
$status->warning( new Message( 'fooBar!', [ 'foo', 'bar' ] ) );
$testCases['1MessageWarning'] = [
$status,
- "<fooBar!>",
+ "⧼fooBar!⧽",
"(wrap-short: (fooBar!: foo, bar))",
- "<p><fooBar!>\n</p>",
+ "<p>⧼fooBar!⧽\n</p>",
"<p>(wrap-short: (fooBar!: foo, bar))\n</p>",
];
$status->warning( new Message( 'fooBar2!' ) );
$testCases['2MessageWarnings'] = [
$status,
- "* <fooBar!>\n* <fooBar2!>\n",
+ "* ⧼fooBar!⧽\n* ⧼fooBar2!⧽\n",
"(wrap-long: * (fooBar!: foo, bar)\n* (fooBar2!)\n)",
- "<ul><li> <fooBar!></li>\n<li> <fooBar2!></li></ul>\n",
+ "<ul><li> ⧼fooBar!⧽</li>\n<li> ⧼fooBar2!⧽</li></ul>\n",
"<p>(wrap-long: * (fooBar!: foo, bar)\n</p>\n<ul><li> (fooBar2!)</li></ul>\n<p>)\n</p>",
];
];
}
+ /**
+ * @dataProvider provideErrorsWarningsOnly
+ * @covers Status::getErrorsOnlyStatus
+ * @covers Status::getWarningsOnlyStatus
+ */
+ public function testGetErrorsWarningsOnlyStatus( $errorText, $warningText, $type, $errorResult,
+ $warningResult
+ ) {
+ $status = Status::newGood();
+ if ( $errorText ) {
+ $status->fatal( $errorText );
+ }
+ if ( $warningText ) {
+ $status->warning( $warningText );
+ }
+ $testStatus = $status->splitByErrorType()[$type];
+ $this->assertEquals( $errorResult, $testStatus->getErrorsByType( 'error' ) );
+ $this->assertEquals( $warningResult, $testStatus->getErrorsByType( 'warning' ) );
+ }
+
+ public static function provideErrorsWarningsOnly() {
+ return [
+ [
+ 'Just an error',
+ 'Just a warning',
+ 0,
+ [
+ 0 => [
+ 'type' => 'error',
+ 'message' => 'Just an error',
+ 'params' => []
+ ],
+ ],
+ [],
+ ], [
+ 'Just an error',
+ 'Just a warning',
+ 1,
+ [],
+ [
+ 0 => [
+ 'type' => 'warning',
+ 'message' => 'Just a warning',
+ 'params' => []
+ ],
+ ],
+ ], [
+ null,
+ null,
+ 1,
+ [],
+ [],
+ ], [
+ null,
+ null,
+ 0,
+ [],
+ [],
+ ]
+ ];
+ }
+
}