Skip to content

Commit

Permalink
Test if block.json is not there (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
tfirdaus authored Oct 10, 2024
1 parent 4f5049b commit 679b4b7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/Foundation/Blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use RecursiveDirectoryIterator;
use SplFileInfo;

use function file_exists;
use function is_dir;

class Blocks
Expand Down Expand Up @@ -36,6 +37,10 @@ public function register(): void
continue;
}

if (! file_exists($block->getRealPath() . '/block.json')) {
continue;
}

register_block_type($block->getRealPath());
}
}
Expand Down
1 change: 1 addition & 0 deletions tests/app/Foundation/BlocksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ public function testRegister(): void
self::assertTrue(isset($blocks['codex/block-a']));
self::assertTrue(isset($blocks['codex/block-b']));
self::assertFalse(isset($blocks['codex/block-c']));
self::assertFalse(isset($blocks['codex/block-c']));
}
}
Empty file.

0 comments on commit 679b4b7

Please sign in to comment.