mirror of
https://github.com/joomla/joomla-cms.git
synced 2024-06-30 17:13:41 +00:00
system test com_templates webservices (#41695)
* sitestyles * adminstyle
This commit is contained in:
parent
a75867224d
commit
b3f5c9fe0e
|
@ -88,7 +88,7 @@ class StylesController extends ApiController
|
|||
// If we are updating an item the template is a readonly property based on the ID
|
||||
if ($this->input->getMethod() === 'PATCH') {
|
||||
if (\array_key_exists('template', $data)) {
|
||||
throw new InvalidParameterException('The template property cannot be modified for an existing style');
|
||||
unset($data['template']);
|
||||
}
|
||||
|
||||
$model = $this->getModel(Inflector::singularize($this->contentType), '', ['ignore_request' => true]);
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
describe('Test that templates administrator styles API endpoint', () => {
|
||||
it('can deliver a list of templates administrator styles', () => {
|
||||
cy.api_get('/templates/styles/administrator')
|
||||
.then((response) => cy.wrap(response).its('body').its('data.0').its('attributes')
|
||||
.its('template')
|
||||
.should('include', 'atum'));
|
||||
});
|
||||
|
||||
it('can deliver a single templates administrator style', () => {
|
||||
cy.api_get('/templates/styles/administrator')
|
||||
.then((response) => cy.wrap(response).its('body').its('data.0').its('attributes')
|
||||
.its('id'))
|
||||
.then((id) => {
|
||||
cy.api_get(`/templates/styles/administrator/${id}`)
|
||||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes')
|
||||
.its('template')
|
||||
.should('include', 'atum'));
|
||||
});
|
||||
});
|
||||
|
||||
it('can modify a single template administrator style', () => {
|
||||
cy.api_get('/templates/styles/administrator')
|
||||
.then((response) => cy.wrap(response).its('body').its('data.0').its('attributes')
|
||||
.its('id'))
|
||||
.then((id) => {
|
||||
const updatedStyle = {
|
||||
title: 'automated test template administrator style',
|
||||
};
|
||||
cy.api_patch(`/templates/styles/administrator/${id}`, updatedStyle)
|
||||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes')
|
||||
.its('title')
|
||||
.should('equal', 'automated test template administrator style'));
|
||||
});
|
||||
});
|
||||
});
|
35
tests/System/integration/api/com_templates/Site.cy.js
Normal file
35
tests/System/integration/api/com_templates/Site.cy.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
describe('Test that templates API endpoint', () => {
|
||||
it('can deliver a list of templates', () => {
|
||||
cy.api_get('/templates/styles/site')
|
||||
.then((response) => cy.wrap(response).its('body').its('data.0').its('attributes')
|
||||
.its('template')
|
||||
.should('include', 'cassiopeia'));
|
||||
});
|
||||
|
||||
it('can deliver a single template', () => {
|
||||
cy.api_get('/templates/styles/site')
|
||||
.then((response) => cy.wrap(response).its('body').its('data.0').its('attributes')
|
||||
.its('id'))
|
||||
.then((id) => {
|
||||
cy.api_get(`/templates/styles/site/${id}`)
|
||||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes')
|
||||
.its('template')
|
||||
.should('include', 'cassiopeia'));
|
||||
});
|
||||
});
|
||||
|
||||
it('can modify a single template', () => {
|
||||
cy.api_get('/templates/styles/site')
|
||||
.then((response) => cy.wrap(response).its('body').its('data.0').its('attributes')
|
||||
.its('id'))
|
||||
.then((id) => {
|
||||
const updatedStyle = {
|
||||
title: 'automated test template site style',
|
||||
};
|
||||
cy.api_patch(`/templates/styles/site/${id}`, updatedStyle)
|
||||
.then((response) => cy.wrap(response).its('body').its('data').its('attributes')
|
||||
.its('title')
|
||||
.should('equal', 'automated test template site style'));
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user