Skip to content

Commit

Permalink
Renamed getNumberOfBytes in numberOfBytes + tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielelana committed Aug 2, 2016
1 parent 2cef6a7 commit ecd7faf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ByteUnits/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private function ensureIsNotNegative($numberOfBytes)
return $numberOfBytes;
}

public function getNumberOfBytes()
public function numberOfBytes()
{
return $this->numberOfBytes;
}
Expand Down
11 changes: 11 additions & 0 deletions tests/ByteUnits/FormatInBinarySystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,15 @@ public function testFormatInByteUnitWithPrecision()
$this->assertEquals('0.001TiB', $bytes->format('TiB/000'));
$this->assertEquals('0.001137TiB', $bytes->format('TiB/6'));
}

public function testNumberOfBytes()
{
$this->assertEquals('0', Binary::bytes(0)->numberOfBytes());
$this->assertEquals('1', Binary::bytes(1)->numberOfBytes());
$this->assertEquals('1024', Binary::bytes(1024)->numberOfBytes());
$this->assertEquals('1280', Binary::bytes(1280)->numberOfBytes());
$this->assertEquals('1572864', Binary::bytes(1572864)->numberOfBytes());
$this->assertEquals('1879048192', Binary::bytes(1879048192)->numberOfBytes());
$this->assertEquals('2199023255552', Binary::bytes(2199023255552)->numberOfBytes());
}
}

0 comments on commit ecd7faf

Please sign in to comment.