Skip to content

Commit

Permalink
Return memory limit as an MBytes string
Browse files Browse the repository at this point in the history
  • Loading branch information
bennothommo committed Jun 16, 2021
1 parent 3604e57 commit 03497cb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/Composer.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,13 @@ public function setTimeout(int $timeout)
/**
* Gets the memory limit for a Composer command.
*
* The memory limit is recorded as MBytes. By default, this is 1536 (1.5 GBytes)
* The memory limit is recorded (and returned) as MBytes. By default, this is 1536 (1.5 GBytes)
*
* @return int
* @return string
*/
public function getMemoryLimit()
{
return $this->memoryLimit;
return $this->memoryLimit . 'M';
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Cases/ComposerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ public function itCanSetAndGetTimeout(): void
*/
public function itCanSetAndGetMemoryLimit(): void
{
$this->assertEquals(1536, $this->composer->getMemoryLimit());
$this->assertEquals('1536M', $this->composer->getMemoryLimit());

$this->assertSame($this->composer, $this->composer->setMemoryLimit(2048));

$this->assertEquals(2048, $this->composer->getMemoryLimit());
$this->assertEquals('2048M', $this->composer->getMemoryLimit());
}
}

0 comments on commit 03497cb

Please sign in to comment.