Skip to content

Commit

Permalink
Renaming "createFromBinary" to "createFromBuffer"
Browse files Browse the repository at this point in the history
  • Loading branch information
Rican7 committed May 29, 2013
1 parent a233c10 commit bd7b832
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
44 changes: 22 additions & 22 deletions FileManager/FileObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@
class FileObjectTest extends AbstractFileObjectTest
{

public function testCreateFromBinary()
public function testcreateFromBuffer()
{
$test_file = $this->getTestFileByBaseName('photo.jpg');

$binary_file_data = file_get_contents($test_file);
$test_name = 'testtttttt';

$file_object = FileObject::createFromBinary($binary_file_data);
$file_object_with_name = FileObject::createFromBinary($binary_file_data, $test_name);
$file_object = FileObject::createFromBuffer($binary_file_data);
$file_object_with_name = FileObject::createFromBuffer($binary_file_data, $test_name);

$this->assertSame(FileObject::DEFAULT_NAME, $file_object->getName());
$this->assertSame($test_name, $file_object_with_name->getName());
Expand Down Expand Up @@ -139,7 +139,7 @@ public function testGetResource($file_object)
}

/**
* @depends testCreateFromBinary
* @depends testcreateFromBuffer
*/
public function testGetWrapperInfo($file_object)
{
Expand All @@ -154,7 +154,7 @@ public function testGetWrapperInfo($file_object)
}

/**
* @depends testCreateFromBinary
* @depends testcreateFromBuffer
*/
public function testIsWrapped($file_object)
{
Expand All @@ -169,7 +169,7 @@ public function testIsWrappedBase64()
}

/**
* @depends testCreateFromBinary
* @depends testcreateFromBuffer
*/
public function testIsWrappedHex($file_object)
{
Expand All @@ -183,9 +183,9 @@ public function testGetRaw()
$test_text = 'this is a test';
$test_text_mime = 'text/donkey';

$wrapped_binary = FileObject::createFromBinary(file_get_contents($test_file_jpg));
$wrapped_base64_raw = FileObject::createFromBinary(base64_encode($test_text));
$wrapped_base64_image = FileObject::createFromBinary(file_get_contents($test_file_base64));
$wrapped_binary = FileObject::createFromBuffer(file_get_contents($test_file_jpg));
$wrapped_base64_raw = FileObject::createFromBuffer(base64_encode($test_text));
$wrapped_base64_image = FileObject::createFromBuffer(file_get_contents($test_file_base64));
$raw_binary = new FileObject($test_file_jpg);
$raw_base64 = new FileObject($test_file_base64);
$raw_base64_text = new FileObject('data://'. $test_text_mime .';base64,'. base64_encode($test_text));
Expand All @@ -208,8 +208,8 @@ public function testGetBase64()
$test_text = 'this is a test';
$test_text_mime = 'text/donkey';

$wrapped_binary = FileObject::createFromBinary(file_get_contents($test_file_jpg));
$wrapped_base64_image = FileObject::createFromBinary(file_get_contents($test_file_base64));
$wrapped_binary = FileObject::createFromBuffer(file_get_contents($test_file_jpg));
$wrapped_base64_image = FileObject::createFromBuffer(file_get_contents($test_file_base64));
$raw_binary = new FileObject($test_file_jpg);
$raw_base64_text = new FileObject('data://'. $test_text_mime .';base64,'. base64_encode($test_text));
$raw_text = new FileObject('data://'. $test_text_mime .','. $test_text);
Expand All @@ -230,8 +230,8 @@ public function testGetHash()
$test_file_jpg = $this->getTestFileByBaseName('photo.jpg');
$test_file_base64 = $this->getTestFileByBaseName('photo.base64');

$wrapped_binary = FileObject::createFromBinary(file_get_contents($test_file_jpg));
$wrapped_base64 = FileObject::createFromBinary(file_get_contents($test_file_base64));
$wrapped_binary = FileObject::createFromBuffer(file_get_contents($test_file_jpg));
$wrapped_base64 = FileObject::createFromBuffer(file_get_contents($test_file_base64));
$raw_binary = new FileObject($test_file_jpg);
$raw_base64 = new FileObject($test_file_base64);

Expand All @@ -247,8 +247,8 @@ public function testGetNameHash()
$test_file_jpg = $this->getTestFileByBaseName('photo.jpg');
$test_file_base64 = $this->getTestFileByBaseName('photo.base64');

$wrapped_binary = FileObject::createFromBinary(file_get_contents($test_file_jpg));
$wrapped_base64 = FileObject::createFromBinary(file_get_contents($test_file_base64));
$wrapped_binary = FileObject::createFromBuffer(file_get_contents($test_file_jpg));
$wrapped_base64 = FileObject::createFromBuffer(file_get_contents($test_file_base64));
$raw_binary = new FileObject($test_file_jpg);
$raw_base64 = new FileObject($test_file_base64);

Expand All @@ -263,9 +263,9 @@ public function testGetExtension()
$test_file_base64 = $this->getTestFileByBaseName('photo.base64');
$test_file_php = __FILE__;

$wrapped_binary = FileObject::createFromBinary(file_get_contents($test_file_jpg));
$wrapped_base64 = FileObject::createFromBinary(file_get_contents($test_file_base64));
$wrapped_binary_php = FileObject::createFromBinary(file_get_contents($test_file_php));
$wrapped_binary = FileObject::createFromBuffer(file_get_contents($test_file_jpg));
$wrapped_base64 = FileObject::createFromBuffer(file_get_contents($test_file_base64));
$wrapped_binary_php = FileObject::createFromBuffer(file_get_contents($test_file_php));
$raw_binary = new FileObject($test_file_jpg);
$raw_base64 = new FileObject($test_file_base64);
$raw_binary_php = new FileObject($test_file_php);
Expand All @@ -288,9 +288,9 @@ public function testGetObfuscatedName()
$test_file_base64 = $this->getTestFileByBaseName('photo.base64');
$test_file_php = __FILE__;

$wrapped_binary = FileObject::createFromBinary(file_get_contents($test_file_jpg));
$wrapped_base64 = FileObject::createFromBinary(file_get_contents($test_file_base64));
$wrapped_binary_php = FileObject::createFromBinary(file_get_contents($test_file_php));
$wrapped_binary = FileObject::createFromBuffer(file_get_contents($test_file_jpg));
$wrapped_base64 = FileObject::createFromBuffer(file_get_contents($test_file_base64));
$wrapped_binary_php = FileObject::createFromBuffer(file_get_contents($test_file_php));
$raw_binary = new FileObject($test_file_jpg);
$raw_base64 = new FileObject($test_file_base64);
$raw_binary_php = new FileObject($test_file_php);
Expand Down Expand Up @@ -348,7 +348,7 @@ public function testCustomImageClassConverterWorks()
public function testMimeAliases()
{
$image_file_obj = new FileObject($this->getTestFileByBaseName('photo.jpg'));
$text_file_obj = FileObject::createFromBinary('test and stuff');
$text_file_obj = FileObject::createFromBuffer('test and stuff');

$this->assertTrue($image_file_obj->isImage());
$this->assertFalse($text_file_obj->isImage());
Expand Down
2 changes: 1 addition & 1 deletion FileManager/ImageObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public function testMultipleFormatCompliance()
$test_file_jpg = $this->getTestFileByBaseName('photo.jpg');
$test_file_base64 = $this->getTestFileByBaseName('photo.base64');

$wrapped_binary = ImageObject::createFromBinary(file_get_contents($test_file_jpg));
$wrapped_binary = ImageObject::createFromBuffer(file_get_contents($test_file_jpg));
$wrapped_base64 = ImageObject::createFromBase64Encoded(file_get_contents($test_file_base64));
$raw_binary = new ImageObject($test_file_jpg);
$raw_base64_text = new ImageObject('data://image/jpeg;base64,'. file_get_contents($test_file_base64));
Expand Down
6 changes: 3 additions & 3 deletions FileObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public function __construct($filename, $open_mode = 'r', $use_include_path = fal
* @access public
* @return FileObject
*/
public static function createFromBinary($raw_binary_data, $name = null)
public static function createFromBuffer($raw_binary_data, $name = null)
{
// TODO: Convert to "is_buffer" or "is_binary" once available (PHP 6)
if (!is_string($raw_binary_data)) {
Expand Down Expand Up @@ -176,7 +176,7 @@ public static function createFromBinary($raw_binary_data, $name = null)
/**
* Create an instance of a FileObject from a base64 encoded string
*
* @see FileObject::createFromBinary()
* @see FileObject::createFromBuffer()
* @param string $base64_encoded_data
* @param string $name
* @throws InvalidArgumentException If the "$base64_encoded_data" isn't a string
Expand All @@ -192,7 +192,7 @@ public static function createFromBase64Encoded($base64_encoded_data, $name = nul

$decoded = static::base64Decode($base64_encoded_data);

return static::createFromBinary($decoded, $name);
return static::createFromBuffer($decoded, $name);
}

/**
Expand Down

0 comments on commit bd7b832

Please sign in to comment.