Skip to content
This repository has been archived by the owner on Jul 6, 2020. It is now read-only.

Commit

Permalink
Improve acceptance test
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkoltan committed Apr 9, 2019
1 parent c58e2d7 commit ec48f76
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions tests/Acceptance/CategoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testGetCategory()
EOQ;
$this->executeQuery($query);

$this->assertEquals(200, $this->httpStatus);
$this->assertHttpStatusOK();
$this->assertEquals('subcategory1', $this->queryResult['data']['category']['name']);
}

Expand All @@ -57,11 +57,9 @@ public function testNotFound()
EOQ;
$this->executeQuery($query);

$this->assertEquals(400, $this->httpStatus);
$this->assertEquals(
'Category with id "nonexistingid" not found.',
$this->queryResult['errors'][0]['message']);
$this->assertTrue(0 === strpos($this->logResult, 'Category with id "nonexistingid" not found.'));
$this->assertHttpStatus(404);
$this->assertErrorMessage('Category with id "nonexistingid" not found.');
$this->assertLogMessageContains('Category with id "nonexistingid" not found.');
}

public function testGetRootCategories()
Expand All @@ -76,7 +74,7 @@ public function testGetRootCategories()
EOQ;
$this->executeQuery($query);

$this->assertEquals(200, $this->httpStatus);
$this->assertHttpStatusOK();
$found = false;
foreach ($this->queryResult['data']['categories'] as $categoryArray) {
if ($categoryArray['name'] == 'rootcategory') {
Expand All @@ -98,7 +96,7 @@ public function testGetCategories()
EOQ;
$this->executeQuery($query);

$this->assertEquals(200, $this->httpStatus);
$this->assertHttpStatusOK();
$this->assertEquals(2, sizeof($this->queryResult['data']['categories']));
}

Expand All @@ -112,7 +110,7 @@ public function testAddCategory()
EOQ;
$this->executeQuery($query, 'admin');

$this->assertEquals(200, $this->httpStatus);
$this->assertHttpStatusOK();
$this->assertEquals(32, strlen($this->queryResult['data']['addCategory']));
}

Expand All @@ -126,7 +124,7 @@ public function testAddCategoryNoPermission()
EOQ;
$this->executeQuery($query, 'customer');

$this->assertEquals(403, $this->httpStatus);
$this->assertHttpStatus(403);
}

}

0 comments on commit ec48f76

Please sign in to comment.