forked from parse-community/parse-php-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParseBytesTest.php
More file actions
50 lines (41 loc) · 1.25 KB
/
Copy pathParseBytesTest.php
File metadata and controls
50 lines (41 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace Parse\Test;
use Parse\ParseBytes;
use Parse\ParseObject;
use Parse\ParseQuery;
class ParseBytesTest extends \PHPUnit_Framework_TestCase
{
public static function setUpBeforeClass()
{
Helper::setUp();
}
public function setUp()
{
Helper::clearClass('BytesObject');
}
public function tearDown()
{
Helper::clearClass('BytesObject');
Helper::tearDown();
}
public function testParseBytesFromArray()
{
$obj = ParseObject::create('BytesObject');
$bytes = ParseBytes::createFromByteArray([70, 111, 115, 99, 111]);
$obj->set('byteColumn', $bytes);
$obj->save();
$query = new ParseQuery('BytesObject');
$objAgain = $query->get($obj->getObjectId());
$this->assertEquals('Fosco', $objAgain->get('byteColumn'));
}
public function testParseBytesFromBase64Data()
{
$obj = ParseObject::create('BytesObject');
$bytes = ParseBytes::createFromBase64Data('R3JhbnRsYW5k');
$obj->set('byteColumn', $bytes);
$obj->save();
$query = new ParseQuery('BytesObject');
$objAgain = $query->get($obj->getObjectId());
$this->assertEquals('Grantland', $objAgain->get('byteColumn'));
}
}