mirror of
https://github.com/danog/parallel.git
synced 2024-11-26 20:34:40 +01:00
27 lines
748 B
PHP
27 lines
748 B
PHP
<?php
|
|
|
|
namespace Amp\Parallel\Test\Worker;
|
|
|
|
use Amp\Parallel\Worker\Internal\Job;
|
|
use Amp\PHPUnit\TestCase;
|
|
|
|
class JobTest extends TestCase {
|
|
public function testGetJob() {
|
|
$task = new TestTask(42);
|
|
$job = new Job($task);
|
|
$this->assertSame($task, $job->getTask());
|
|
}
|
|
|
|
/**
|
|
* @expectedException \Error
|
|
* @expectedExceptionMessage Classes implementing Amp\Parallel\Worker\Task must be autoloadable by the Composer autoloader
|
|
*/
|
|
public function testUnserialiableClass() {
|
|
$task = new TestTask(42);
|
|
$job = new Job($task);
|
|
$serialized = \serialize($job);
|
|
$job = \unserialize($serialized, ['allowed_classes' => [Job::class]]);
|
|
$task = $job->getTask();
|
|
}
|
|
}
|