From 7020e84b2dc07f2cc7f8294d65d4e95e1e763b67 Mon Sep 17 00:00:00 2001 From: Andrey Savchenko Date: Mon, 19 Feb 2018 16:50:38 +0200 Subject: [PATCH] Added hook event tests. --- tests/Event/EventTest.php | 77 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 tests/Event/EventTest.php diff --git a/tests/Event/EventTest.php b/tests/Event/EventTest.php new file mode 100644 index 0000000..f9bbbaa --- /dev/null +++ b/tests/Event/EventTest.php @@ -0,0 +1,77 @@ +get_events(); + + $this->assertInternalType( 'array', $events ); + $this->assertNotEmpty( $events ); + } + + public function testGenesis() { + + $genesis = new Genesis_Events(); + $this->assertEmpty( $genesis->get_events() ); + + Functions\expect( 'genesis' )->zeroOrMoreTimes(); + $events = $genesis->get_events(); + + $this->assertInternalType( 'array', $events ); + $this->assertNotEmpty( $events ); + } + + public function testHybrid() { + + $hybrid = new Hybrid_Events(); + $this->assertEmpty( $hybrid->get_events() ); + + Functions\expect( 'hybrid_get_prefix' )->once()->andReturn( 'hybrid' ); + Functions\expect( 'get_theme_support' ) + ->once() + ->with( 'hybrid-core-sidebars' ) + ->andReturn( [ [ 'primary' ] ] ); + + $events = $hybrid->get_events(); + + $this->assertInternalType( 'array', $events ); + $this->assertNotEmpty( $events ); + } + + public function testTha() { + + $tha = new THA_Events(); + $this->assertEmpty( $tha->get_events() ); + + define( 'THA_HOOKS_VERSION', '1.0' ); + + $events = $tha->get_events(); + + $this->assertInternalType( 'array', $events ); + $this->assertNotEmpty( $events ); + } + + public function testYoast() { + + $yoast = new Yoast_Events(); + $this->assertEmpty( $yoast->get_events() ); + + $this->getMockBuilder( 'WPSEO_Frontend' )->allowMockingUnknownTypes()->getMock(); + + $events = $yoast->get_events(); + + $this->assertInternalType( 'array', $events ); + $this->assertNotEmpty( $events ); + } +}