From 8ac4b3671bd1044dc55963def22dd75a58cb6ff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Burnichon?= Date: Tue, 1 Mar 2016 12:42:37 +0100 Subject: [PATCH] Fix invalid process comparison --- .../Tests/Phrasea/TaskManager/TaskTest.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/tests/Alchemy/Tests/Phrasea/TaskManager/TaskTest.php b/tests/Alchemy/Tests/Phrasea/TaskManager/TaskTest.php index 29e08f4358..9e5660fa16 100644 --- a/tests/Alchemy/Tests/Phrasea/TaskManager/TaskTest.php +++ b/tests/Alchemy/Tests/Phrasea/TaskManager/TaskTest.php @@ -7,33 +7,32 @@ use Alchemy\Phrasea\TaskManager\Task; class TaskTest extends TaskTestCase { + private $process; + public function testThatCreatedProcessAreDifferents() { - $process = $this->getMockBuilder('Symfony\Component\Process\Process') - ->disableOriginalConstructor() - ->getMock(); - $taskEntity = $this->getMock('Alchemy\Phrasea\Model\Entities\Task'); - $task = new Task($taskEntity, 'task number', 42, $process); + $task = $this->getTask(); $created1 = $task->createProcess(); - $this->assertEquals($process, $created1); - $this->assertNotSame($process, $created1); + $this->assertEquals($this->process, $created1); + $this->assertNotSame($this->process, $created1); $created2 = $task->createProcess(); $this->assertEquals($created1, $created2); - $this->assertNotSame($process, $created2); + $this->assertNotSame($this->process, $created2); $this->assertNotSame($created1, $created2); } protected function getTask() { - $process = $this->getMockBuilder('Symfony\Component\Process\Process') + $this->process = $this->getMockBuilder('Symfony\Component\Process\Process') ->disableOriginalConstructor() + ->disableOriginalClone() ->getMock(); $taskEntity = $this->getMock('Alchemy\Phrasea\Model\Entities\Task'); - return new Task($taskEntity, 'task number', 42, $process); + return new Task($taskEntity, 'task number', 42, $this->process); } }