Jarves\Tests\REST\BasicTest::testListing PHP Метод

testListing() публичный Метод

public testListing ( )
    public function testListing()
    {
        $response = $this->restCall('/jarves/object/jarves/node/');
        $this->assertEquals(200, $response['status']);
        $this->assertGreaterThanOrEqual(14, count($response['data']), "we have at least 14 nodes from the installation script.");
        ItemQuery::create()->deleteAll();
        $response = $this->restCall('/jarves/object/test/item/');
        $this->assertEquals(200, $response['status']);
        $this->assertNull($response['data'], 'if we have no items, we should get NULL.');
        $item1 = new Item();
        $item1->setTitle('Item 1');
        $item1->save();
        $item2 = new Item();
        $item2->setTitle('Item 2');
        $item2->save();
        $id2 = $item2->getId();
        $response = $this->restCall('/jarves/object/test/item/');
        $this->assertEquals(200, $response['status']);
        $this->assertEquals(2, count($response['data']));
        $response = $this->restCall('/jarves/object/test/item/' . $id2);
        $this->assertEquals(200, $response['status']);
        $this->assertEquals($id2, $response['data']['id']);
    }