corcel / acf

Advanced Custom Fields (ACF) plugin for Corcel
127 stars 100 forks source link

Changes to allow basic field to fetch fields with empty (but not null fields). #17

Closed cjke closed 7 years ago

cjke commented 7 years ago

This is in relation to #4

Note that the tests use assertSame instead of assertEqual because with assertEqual returns true for assertEqual("", null), which is not what we want.

Results as per the contributing guide:

ubuntu@wordpress /v/w/s/acf> ./vendor/phpunit/phpunit/phpunit
PHPUnit 4.2.2 by Sebastian Bergmann.

Configuration read from /var/www/sites/acf/phpunit.xml

................................................

Time: 510 ms, Memory: 8.00MB

OK (48 tests, 92 assertions)

Out of interest, you can run the new tests without the changes to BasicField and see how pulling out a "" wasn't possible.

Also note, I needed to add a new Page in WP with all the empty fields (the new sql dump includes that):

image

This was added to the Custom Field manually (also in the sql dump)

image

Third times a charm

jgrossi commented 7 years ago

@cjke thanks! can you just change the branch to develop please?

cjke commented 7 years ago

Doh, can't believe I missed that - you even have it in "bold" on the contribution guide lines.