public function testTermTaxonomyUpdated() { $doc = new Core\Doc(); $tableName = 'main'; $data = file_get_contents(OPSOU_DIR . '/tests/test.json'); $data = json_decode($data, true); $posts = array(); foreach ($data as $key => $value) { $item = array(); $item['ID'] = $value['fields']['object_id']; $item['post_date'] = $value['fields']['date']; $item['post_title'] = $value['fields']['title']; $item['post_content'] = $value['fields']['content']; $item['post_excerpt'] = $value['fields']['excerpt']; $item['post_name'] = $value['fields']['slug']; $item['post_modified'] = $value['fields']['modified']; $item['post_parent'] = $value['fields']['parent']; $item['menu_order'] = $value['fields']['menu_order']; $item['post_type'] = $value['fields']['type']; $item['guid'] = $value['fields']['permalink']; $item['featured_image'] = $value['fields']['featured_image']; $item['post_author'] = $value['fields']['author_id']; $item['author'] = $value['fields']['author']; $item['categories'] = $value['fields']['categories']; $item['tags'] = $value['fields']['tags']; array_push($posts, $item); } $docsToUpload = $doc->buildBatch($posts); $this->assertCount(count($posts), $docsToUpload); $result = $doc->update($docsToUpload, $tableName); $this->assertCount(2, $result); $this->assertJson($result['jsonData']); }
public function testPostToOpenSearchObject() { $doc = new Core\Doc(); $post = new \WP_Post(); $row = $doc->postToOpenSearchObject($post); $this->assertNotEmpty($row); }