Skip to content

Commit a9d6443

Browse files
committed
stop using TestCase::iniSet()
1 parent 5fd6274 commit a9d6443

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

Tests/UriSignerTest.php

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,25 @@ public function testCheck()
6464

6565
public function testCheckWithDifferentArgSeparator()
6666
{
67-
$this->iniSet('arg_separator.output', '&');
68-
$signer = new UriSigner('foobar');
69-
70-
$this->assertSame(
71-
'http://example.com/foo?_hash=rIOcC%2FF3DoEGo%2FvnESjSp7uU9zA9S%2F%2BOLhxgMexoPUM%3D&baz=bay&foo=bar',
72-
$signer->sign('http://example.com/foo?foo=bar&baz=bay')
73-
);
74-
$this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&baz=bay')));
75-
76-
$this->assertSame(
77-
'http://example.com/foo?_expiration=2145916800&_hash=xLhnPMzV3KqqHaaUffBUJvtRDAZ4%2FZ9Y8Sw%2BgmS%2B82Q%3D&baz=bay&foo=bar',
78-
$signer->sign('http://example.com/foo?foo=bar&baz=bay', new \DateTimeImmutable('2038-01-01 00:00:00', new \DateTimeZone('UTC')))
79-
);
80-
$this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&baz=bay', new \DateTimeImmutable('2099-01-01 00:00:00'))));
67+
$oldArgSeparatorOutputValue = ini_set('arg_separator.output', '&');
68+
69+
try {
70+
$signer = new UriSigner('foobar');
71+
72+
$this->assertSame(
73+
'http://example.com/foo?_hash=rIOcC%2FF3DoEGo%2FvnESjSp7uU9zA9S%2F%2BOLhxgMexoPUM%3D&baz=bay&foo=bar',
74+
$signer->sign('http://example.com/foo?foo=bar&baz=bay')
75+
);
76+
$this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&baz=bay')));
77+
78+
$this->assertSame(
79+
'http://example.com/foo?_expiration=2145916800&_hash=xLhnPMzV3KqqHaaUffBUJvtRDAZ4%2FZ9Y8Sw%2BgmS%2B82Q%3D&baz=bay&foo=bar',
80+
$signer->sign('http://example.com/foo?foo=bar&baz=bay', new \DateTimeImmutable('2038-01-01 00:00:00', new \DateTimeZone('UTC')))
81+
);
82+
$this->assertTrue($signer->check($signer->sign('http://example.com/foo?foo=bar&baz=bay', new \DateTimeImmutable('2099-01-01 00:00:00'))));
83+
} finally {
84+
ini_set('arg_separator.output', $oldArgSeparatorOutputValue);
85+
}
8186
}
8287

8388
public function testCheckWithRequest()

0 commit comments

Comments
 (0)