PHP Classes

File: tests/api/Delete/AnExistingArticleCept.php

Recommend this page to a friend!
  Classes of Gjero Krsteski  >  PHP Nuclear Reactor  >  tests/api/Delete/AnExistingArticleCept.php  >  Download  
File: tests/api/Delete/AnExistingArticleCept.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Nuclear Reactor
Asynchronous RESTful API using ReactPHP and PIMF
Author: By
Last change: Update of tests/api/Delete/AnExistingArticleCept.php
Date: 2 years ago
Size: 547 bytes
 

Contents

Class file image Download
<?php
$I
= new ApiTester($scenario);
$I->wantTo('create a new article via API to delete it');

$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');
$I->sendPOST('/articles', ['title' => 'to delete title', 'content' => 'to delete content']);
$I->seeResponseCodeIs(201);
$I->seeResponseIsJson();
$I->seeResponseContains('newId');
$I->seeResponseMatchesJsonType(['newId' => 'integer']);

$body = json_decode($I->grabResponse());

$I->sendDELETE('/articles/'.$body->newId);
$I->seeResponseCodeIs(200);
$I->canSeeResponseEquals('');

For more information send a message to info at phpclasses dot org.