Skip to content
This repository has been archived by the owner on Nov 24, 2024. It is now read-only.

Commit

Permalink
ready for 8.1.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Configuration Manager committed Feb 21, 2020
1 parent 6e0e409 commit b9ff22b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [changelog

## [Unreleased]

## [8.1.1]

### added

- code quality badge
Expand All @@ -12,6 +14,8 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [changelog
### fixed

- fixed default model in FactsFactory (interface bug)
- added getUri suffix optional parameter (interface bug)
- bug in getURI

## [8.1.0]

Expand Down Expand Up @@ -346,7 +350,8 @@ Completelly rewitten
- Moved from google code
- Code, doc and tests completed

[Unreleased]: /~https://github.com/linkeddatacenter/BOTK-core/compare/8.1.0...HEAD
[Unreleased]: /~https://github.com/linkeddatacenter/BOTK-core/compare/8.1.1...HEAD
[8.1.1]: /~https://github.com/linkeddatacenter/BOTK-core/compare/8.1.1...8.1.0
[8.1.0]: /~https://github.com/linkeddatacenter/BOTK-core/compare/8.1.0...8.0.0
[8.0.0]: /~https://github.com/linkeddatacenter/BOTK-core/compare/8.0.0...7.7.1
[7.7.1]: /~https://github.com/linkeddatacenter/BOTK-core/compare/7.7.1...7.7.0
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
![logo](http://linkeddata.center/resources/v4/logo/Logo-colori-trasp_oriz-640x220.png)
# BOTK\Core
[![Build Status](https://img.shields.io/travis/linkeddatacenter/BOTK-core.svg?style=flat-square)](http://travis-ci.org/linkeddatacenter/BOTK-core)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/linkeddatacenter/BOTK-core/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/linkeddatacenter/BOTK-core/?branch=master)
Expand Down
6 changes: 4 additions & 2 deletions src/Model/AbstractModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,18 @@ public function setIdGenerator($generator)
/**
* returns an uri
*/
public function getUri($id=null)
public function getUri($id=null, $suffix='')
{
assert(!empty($this->data['base'])) ;

$base = (array)$this->data['base']; // base coud be an array

if (empty($id)) {
$idGenerator=$this->uniqueIdGenerator;
$id=$idGenerator($this->data);
}

return $this->data['base'] . $id;
return $base[0] . $id . $suffix;
}


Expand Down
11 changes: 7 additions & 4 deletions tests/unit/Model/SampleSchemaThingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,20 @@ public function testConstructorWithCustomOptions()
/**
* @dataProvider uris
*/
public function testGetUri($data, $expectedData)
public function testGetUri($data, $id, $suffix, $expectedData)
{
$obj = BOTK\Model\SampleSchemaThing::fromArray($data);
$obj->setIdGenerator(function($d){return'abc';});
$this->assertEquals($expectedData, $obj->getUri());
$this->assertEquals($expectedData, $obj->getUri($id,$suffix));
}
public function uris()
{
return array(
array( array(), 'urn:resource:abc'),
array( array('base'=>'http://example.com/resource/'), 'http://example.com/resource/abc'),
array( array(), null, '', 'urn:resource:abc'),
array( array('base'=>'http://example.com/resource/'), null , '', 'http://example.com/resource/abc'),
array( array(), null, '-test', 'urn:resource:abc-test'),
array( array(), 'hello', '-test', 'urn:resource:hello-test'),
array( array('base'=>'http://example.com/resource/'),'my' , '-test', 'http://example.com/resource/my-test'),
);
}

Expand Down

0 comments on commit b9ff22b

Please sign in to comment.