Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boolean type is returned as string #49

Open
istaveren opened this issue Jan 7, 2014 · 4 comments
Open

Boolean type is returned as string #49

istaveren opened this issue Jan 7, 2014 · 4 comments

Comments

@istaveren
Copy link

I noticed that when you send a boolen it will be returned as a string. For example true ends up as "true".

{
"@context":{
"active":"http://localhost/app_dev.php/hydra/vocab#SomeDTO/active"
},

"@type":"http://localhost/app_dev.php/hydra/vocab#SomeDTO",
"active":true
}

I tried to add a unit test for it but the unit testing failed. With

PHP Warning:  file_get_contents(/../vendor/ml/json-ld/ML/JsonLD/Test/tests/expand-manifest.jsonld): failed to open stream: No such file or directory in /../vendor/ml/json-ld/ML/JsonLD/Test/TestManifestIterator.php on line 44

Which is correct because there is no test directory??

How should the unit test be started so that I can add a unit test and try to fix this for boolean type?

@lanthaler
Copy link
Owner

Thanks Iwan for your bug report, even though I’m not sure yet it really is a bug. What exactly are you trying to do?

The “tests” directory is deliberately empty at the moment as it is filled with the test from the official JSON-LD test suite. Have a look at .travis.yml, it runs the following commands

git clone git://github.com/json-ld/json-ld.org.git
mv ./json-ld.org/test-suite/tests ./Test/
rm -rf ./json-ld.org

Doing that will fix the problem. I proposed to create a subtree split for the tests a while ago but there was some pushback. I'll try again shortly. This would mean that the tests can be fetched easily directly by composer.

lanthaler added a commit that referenced this issue Jan 9, 2014
... phpUnit will complain by itself if no tests have been found.

This is related to #49
lanthaler added a commit that referenced this issue Jan 9, 2014
… GitHub

I've created a subtree split of the JSON-LD tests and made a composer package out of it. This simplifies the inclusion of the tests.

This is related to #49
@lanthaler
Copy link
Owner

@istaveren I've created a subtree split of the JSON-LD tests and included them directly as a composer package. You should now be able to run the PHPUnit tests by pulling the latest version and then doing a

 php composer.phar update

Would love to see the test showing the bug you found.

@istaveren
Copy link
Author

Thanks.

You might be right that this is not a bug in this package. I fixed it in the hydra bundle where I hit it.
istaveren/HydraBundle@51e7d68

I will give it I try to reproduce it here.

@istaveren
Copy link
Author

Because Value->getValue() always should return a string this is not a bug. So it is an issue in the HydraBundle deserializer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants