|
@@ 38-50 (lines=13) @@
|
| 35 |
|
$this->assertEquals([], $field->getValueAsIterable()); |
| 36 |
|
} |
| 37 |
|
|
| 38 |
|
public function testFirst_AsArray() |
| 39 |
|
{ |
| 40 |
|
$field = JSONText\Fields\JSONText::create('MyJSON'); |
| 41 |
|
$field->setValue($this->getFixture('array_simple')); |
| 42 |
|
$field->setReturnType('array'); |
| 43 |
|
$this->assertEquals([0 => 'great wall'], $field->first()); |
| 44 |
|
|
| 45 |
|
$field = JSONText\Fields\JSONText::create('MyJSON'); |
| 46 |
|
$field->setValue($this->getFixture('empty')); |
| 47 |
|
$field->setReturnType('array'); |
| 48 |
|
$this->assertInternalType('array', $field->first()); |
| 49 |
|
$this->assertCount(0, $field->first()); |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
public function testFirst_AsJson() |
| 53 |
|
{ |
|
@@ 52-64 (lines=13) @@
|
| 49 |
|
$this->assertCount(0, $field->first()); |
| 50 |
|
} |
| 51 |
|
|
| 52 |
|
public function testFirst_AsJson() |
| 53 |
|
{ |
| 54 |
|
$field = JSONText\Fields\JSONText::create('MyJSON'); |
| 55 |
|
$field->setValue($this->getFixture('array_simple')); |
| 56 |
|
$field->setReturnType('json'); |
| 57 |
|
$this->assertEquals('["great wall"]', $field->first()); |
| 58 |
|
|
| 59 |
|
$field = JSONText\Fields\JSONText::create('MyJSON'); |
| 60 |
|
$field->setValue($this->getFixture('empty')); |
| 61 |
|
$field->setReturnType('json'); |
| 62 |
|
$this->assertInternalType('string', $field->first()); |
| 63 |
|
$this->assertEquals('[]', $field->first()); |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
public function testLast_AsArray() |
| 67 |
|
{ |
|
@@ 66-78 (lines=13) @@
|
| 63 |
|
$this->assertEquals('[]', $field->first()); |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
public function testLast_AsArray() |
| 67 |
|
{ |
| 68 |
|
$field = JSONText\Fields\JSONText::create('MyJSON'); |
| 69 |
|
$field->setValue($this->getFixture('array_simple')); |
| 70 |
|
$field->setReturnType('array'); |
| 71 |
|
$this->assertEquals([6 => 'morris'], $field->last()); |
| 72 |
|
|
| 73 |
|
$field = JSONText\Fields\JSONText::create('MyJSON'); |
| 74 |
|
$field->setValue($this->getFixture('empty')); |
| 75 |
|
$field->setReturnType('array'); |
| 76 |
|
$this->assertInternalType('array', $field->first()); |
| 77 |
|
$this->assertCount(0, $field->first()); |
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
public function testLast_AsJson() |
| 81 |
|
{ |
|
@@ 80-92 (lines=13) @@
|
| 77 |
|
$this->assertCount(0, $field->first()); |
| 78 |
|
} |
| 79 |
|
|
| 80 |
|
public function testLast_AsJson() |
| 81 |
|
{ |
| 82 |
|
$field = JSONText\Fields\JSONText::create('MyJSON'); |
| 83 |
|
$field->setValue($this->getFixture('array_simple')); |
| 84 |
|
$field->setReturnType('json'); |
| 85 |
|
$this->assertEquals('{"6":"morris"}', $field->last()); |
| 86 |
|
|
| 87 |
|
$field = JSONText\Fields\JSONText::create('MyJSON'); |
| 88 |
|
$field->setValue($this->getFixture('empty')); |
| 89 |
|
$field->setReturnType('json'); |
| 90 |
|
$this->assertInternalType('string', $field->first()); |
| 91 |
|
$this->assertEquals('[]', $field->first()); |
| 92 |
|
} |
| 93 |
|
|
| 94 |
|
public function testNth_AsArray() |
| 95 |
|
{ |