| @@ 90-105 (lines=16) @@ | ||
| 87 | /** |
|
| 88 | * Test that a node can be created specifying its body field. |
|
| 89 | */ |
|
| 90 | public function testNodeCreateWithBody() { |
|
| 91 | $title = $this->randomString(); |
|
| 92 | $body = $this->randomString(); |
|
| 93 | $node = (object) [ |
|
| 94 | 'title' => $title, |
|
| 95 | 'type' => 'article', |
|
| 96 | 'body' => $body, |
|
| 97 | ]; |
|
| 98 | $node = $this->driver->createNode($node); |
|
| 99 | ||
| 100 | $entities = $this->storage->loadByProperties(['title' => $title]); |
|
| 101 | $this->assertEquals(1, count($entities)); |
|
| 102 | $entity = reset($entities); |
|
| 103 | $this->assertEquals($body, $entity->get('body')->value); |
|
| 104 | } |
|
| 105 | ||
| 106 | /** |
|
| 107 | * Test that a node can be created and deleted. |
|
| 108 | */ |
|
| @@ 153-168 (lines=16) @@ | ||
| 150 | /** |
|
| 151 | * Test that a node can be created specifying its body field. |
|
| 152 | */ |
|
| 153 | public function testNodeCreateWithBodyByWrapper() { |
|
| 154 | $title = $this->randomString(); |
|
| 155 | $body = $this->randomString(); |
|
| 156 | $fields = [ |
|
| 157 | 'title' => $title, |
|
| 158 | 'type' => 'article', |
|
| 159 | 'body' => $body, |
|
| 160 | ]; |
|
| 161 | $node = DriverEntityDrupal8::create($fields, $this->entityType)->save(); |
|
| 162 | ||
| 163 | $entities = $this->storage->loadByProperties(['title' => $title]); |
|
| 164 | $this->assertEquals(1, count($entities)); |
|
| 165 | $entity = reset($entities); |
|
| 166 | $this->assertEquals($body, $entity->get('body')->value); |
|
| 167 | } |
|
| 168 | ||
| 169 | /** |
|
| 170 | * Test the created and changed fields on a node. |
|
| 171 | */ |
|