Closed Maikuolan closed 5 years ago
@Maikuolan, I think it's important.
This should be done firstly so that we can do unit tests easily.
100% agree. :-)
Working on this now.
I haven't started the documentation for the Cache class yet, and the "What rules to use for what language?" list in the documentation for the L10N class needs more work; I'll get both those two things sorted out soon. Everything else has been documented now though. :-)
If there are any suggestions, or if you find any possible errors, or anything missing, let me know.
Hi @Maikuolan, thank you for your contribution about writing doc.
And I can enhance the unit tests now :).
Hi @Maikuolan, when I write the unit test, I found some errors about the YAML::reconstruct
method.
I found the following sample code is problematic in usage doc:
<?php
$YAML = 'foo: "bar"
1: "abc"
2: "def"
3: "ghi"
jkl: 4
mno: 5
pqr: 6
7: 8
9: 0
boolVal: false
boolVal2: true
multidimensional array:
hello: "world"
hello2: "world2"
hello3: "world3"
';
$Object = new \Maikuolan\Common\YAML($YAML);
echo 'The YAML data, processed into an array:' . PHP_EOL;
var_dump($Object->Data);
echo PHP_EOL . PHP_EOL;
$Reconstructed = $Object->reconstruct($Object->Data);
echo 'Is the reconstructed YAML data, and the original YAML data, the same? ';
echo $YAML === $Reconstructed ? 'Yes.' : 'No.';
The last expected output will be false and it looks like the original is not same as reconstructed YAML data.
Have you checked that before? And it looks like the multidimensional array:
will be missed in reconstructed YAML data.
It looks like the line of 247
has been the problem in YAML
class.
Please check that.
It's weird. When I use the sample code that I mention in the previous comment, it will output the expected result correctly.
When I use PHPUnit to try asserting the expected and result string are equal, it's failed.
Cheers. Looking into this now. :+1:
I think I've fixed the problem now, as of the latest commit. Let me know how it goes. :-)
@Maikuolan, thank you for your help.
I will try to do the unit tests again :).
Cache documentation still pending. I've also recently added a new class, "Demojibakefier". I'll need to document that, too. Anyway, I'll continue working on this soon.
The Cache class and the Demojibakefier class have both now been documented. The only remaining things to do now for the documentation are to finish populating the languages table in the documentation for the L10N class (it's a little short at the moment and doesn't cover many languages), and to get some people to proofread everything, to make sure that there's not any typos or mistakes that I might've missed, and to make sure that it actually makes sense (to people other than myself). :-P
Done. Closing.
Need to add information to the readme to describe how to properly use the package and its classes.