1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<?php
namespace Mediawiki\DataModel\Test;
use Mediawiki\DataModel\EditInfo;
use PHPUnit_Framework_TestCase;
/**
* @covers \Mediawiki\DataModel\EditInfo
* @author Addshore
*/
class EditInfoTest extends PHPUnit_Framework_TestCase {
/**
* @dataProvider provideValidConstruction
*/
public function testValidConstruction( $sum, $minor, $bot ) {
$flags = new EditInfo( $sum, $minor, $bot );
$this->assertEquals( $sum, $flags->getSummary() );
$this->assertEquals( $minor, $flags->getMinor() );
$this->assertEquals( $bot, $flags->getBot() );
}
public function provideValidConstruction() {
return array(
array( '', EditInfo::MINOR, EditInfo::BOT ),
array( '', EditInfo::MINOR, EditInfo::NOTBOT ),
array( '', EditInfo::NOTMINOR, EditInfo::BOT ),
array( '', EditInfo::NOTMINOR, EditInfo::NOTBOT ),
array( 'FOO', EditInfo::NOTMINOR, EditInfo::NOTBOT ),
);
}
/**
* @dataProvider provideInvalidConstruction
*/
public function testInvalidConstruction( $sum, $minor, $bot ) {
$this->setExpectedException( 'InvalidArgumentException' );
new EditInfo( $sum, $minor, $bot );
}
public function provideInvalidConstruction() {
return array(
array( 1, 2, 3 ),
array( "foo", false, 3 ),
array( "foo", 3, false ),
array( array(), true, false ),
);
}
}
|