Skip to content

Commit f3d5895

Browse files
TorstenDittmannpprkut
authored andcommitted
tests: migrate to phpunit 8
1 parent 416658a commit f3d5895

File tree

2 files changed

+13
-17
lines changed

2 files changed

+13
-17
lines changed

test/Resque/Tests/JobHandlerTest.php

+9-13
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,10 @@ public function testJobCanBeQueued()
4040
$this->assertTrue((bool)Resque::enqueue('jobs', 'Test_Job'));
4141
}
4242

43-
/**
44-
* @expectedException \Resque\Exceptions\RedisException
45-
*/
4643
public function testRedisErrorThrowsExceptionOnJobCreation()
4744
{
45+
$this->expectException('\Resque\Exceptions\RedisException');
46+
4847
$mockCredis = $this->getMockBuilder('Credis_Client')
4948
->setMethods(['connect', '__call'])
5049
->getMock();
@@ -69,11 +68,10 @@ public function testQeueuedJobCanBeReserved()
6968
$this->assertEquals('Test_Job', $job->payload['class']);
7069
}
7170

72-
/**
73-
* @expectedException InvalidArgumentException
74-
*/
7571
public function testObjectArgumentsCannotBePassedToJob()
7672
{
73+
$this->expectException('InvalidArgumentException');
74+
7775
$args = new stdClass();
7876
$args->test = 'somevalue';
7977
Resque::enqueue('jobs', 'Test_Job', $args);
@@ -146,22 +144,20 @@ public function testFailedJobExceptionsAreCaught()
146144
$this->assertEquals(1, Stat::get('failed:'.$this->worker));
147145
}
148146

149-
/**
150-
* @expectedException \Resque\Exceptions\ResqueException
151-
*/
152147
public function testJobWithoutPerformMethodThrowsException()
153148
{
149+
$this->expectException('\Resque\Exceptions\ResqueException');
150+
154151
Resque::enqueue('jobs', 'Test_Job_Without_Perform_Method');
155152
$job = $this->worker->reserve();
156153
$job->worker = $this->worker;
157154
$job->perform();
158155
}
159156

160-
/**
161-
* @expectedException Resque\Exceptions\ResqueException
162-
*/
163157
public function testInvalidJobThrowsException()
164158
{
159+
$this->expectException('Resque\Exceptions\ResqueException');
160+
165161
Resque::enqueue('jobs', 'Invalid_Job');
166162
$job = $this->worker->reserve();
167163
$job->worker = $this->worker;
@@ -363,7 +359,7 @@ public function testDequeueSeveralItemsWithArgs()
363359
$this->assertEquals($removedItems, 2);
364360
$this->assertEquals(Resque::size($queue), 1);
365361
$item = Resque::pop($queue);
366-
$this->assertInternalType('array', $item['args']);
362+
$this->assertIsArray($item['args']);
367363
$this->assertEquals(10, $item['args'][0]['bar'], 'Wrong items were dequeued from queue!');
368364
}
369365

test/Resque/Tests/RedisTest.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,10 @@
1515
*/
1616
class RedisTest extends ResqueTestCase
1717
{
18-
/**
19-
* @expectedException \Resque\Exceptions\RedisException
20-
*/
2118
public function testRedisExceptionsAreSurfaced()
2219
{
20+
$this->expectException('\Resque\Exceptions\RedisException');
21+
2322
$mockCredis = $this->getMockBuilder('Credis_Client')
2423
->setMethods(['connect', '__call'])
2524
->getMock();
@@ -194,10 +193,11 @@ public function testParsingValidDsnString($dsn, $expected)
194193

195194
/**
196195
* @dataProvider bogusDsnStringProvider
197-
* @expectedException InvalidArgumentException
198196
*/
199197
public function testParsingBogusDsnStringThrowsException($dsn)
200198
{
199+
$this->expectException('InvalidArgumentException');
200+
201201
// The next line should throw an InvalidArgumentException
202202
$result = Redis::parseDsn($dsn);
203203
}

0 commit comments

Comments
 (0)