'mock-gateway', ); $evaluated = EvaluateSuggestion::evaluate( (object) $suggestion ); $this->assertEquals( (object) $suggestion, $evaluated ); } /** * Test that the gateway is not visible when rules do not pass. */ public function test_is_not_visible() { $suggestion = array( 'id' => 'mock-gateway', 'is_visible' => (object) array( 'type' => 'option', 'option_name' => self::MOCK_OPTION, 'value' => 'a', 'default' => null, 'operation' => '=', ), ); $evaluated = EvaluateSuggestion::evaluate( (object) $suggestion ); $this->assertFalse( $evaluated->is_visible ); } /** * Test that the gateway is returned when visibility rules pass. */ public function test_is_visible() { $suggestion = array( 'id' => 'mock-gateway', 'is_visible' => (object) array( 'type' => 'option', 'option_name' => self::MOCK_OPTION, 'value' => 'a', 'default' => null, 'operation' => '=', ), ); update_option( self::MOCK_OPTION, 'a' ); $evaluated = EvaluateSuggestion::evaluate( (object) $suggestion ); $this->assertTrue( $evaluated->is_visible ); } }