4 * Holds tests for ChronologyProtector abstract MediaWiki class.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * http://www.gnu.org/copyleft/gpl.html
24 use Wikimedia\Rdbms\ChronologyProtector
;
28 * @covers \Wikimedia\Rdbms\ChronologyProtector::__construct
29 * @covers \Wikimedia\Rdbms\ChronologyProtector::getClientId
31 class ChronologyProtectorTest
extends PHPUnit\Framework\TestCase
{
33 * @dataProvider clientIdProvider
34 * @param array $client
35 * @param string $secret
36 * @param string $expectedId
38 public function testClientId( array $client, $secret, $expectedId ) {
39 $bag = new HashBagOStuff();
40 $cp = new ChronologyProtector( $bag, $client, null, $secret );
42 $this->assertEquals( $expectedId, $cp->getClientId() );
45 public function clientIdProvider() {
50 'agent' => "Totally-Not-FireFox"
53 '45e93a9c215c031d38b7c42d8e4700ca',
58 'agent' => "Totally-Not-FireFox"
61 'b1d604117b51746c35c3df9f293c84dc'
66 'agent' => "Totally-FireFox"
69 '731b4e06a65e2346b497fc811571c4d7'
74 'agent' => "Totally-Not-FireFox"
77 'defff51ded73cd901253d874c9b2077d'