| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | class returnMetaArray extends WP_UnitTestCase {
|
|---|
| 4 |
|
|---|
| 5 | function testMetaArray() {
|
|---|
| 6 |
|
|---|
| 7 | // Create post
|
|---|
| 8 | $post_id = $this->factory->post->create();
|
|---|
| 9 |
|
|---|
| 10 | // Value that we want to same and then look for.
|
|---|
| 11 | $value = array(
|
|---|
| 12 | 'foo',
|
|---|
| 13 | 'bar'
|
|---|
| 14 | );
|
|---|
| 15 |
|
|---|
| 16 | // Save the meta field
|
|---|
| 17 | $value_saved = update_post_meta($post_id, 'sampleValue', $value);
|
|---|
| 18 |
|
|---|
| 19 | // Full post
|
|---|
| 20 | $full_post = get_post($post_id);
|
|---|
| 21 |
|
|---|
| 22 | // Compare the values.
|
|---|
| 23 | $this->assertEquals($value, $full_post->sampleValue);
|
|---|
| 24 | }
|
|---|
| 25 | }
|
|---|
| 26 |
|
|---|
| 27 | ?>
|
|---|