PartKeepr\SystemPreferenceBundle\Tests\SystemPreferenceTest::testSystemPreferenceService PHP Method

testSystemPreferenceService() public method

    public function testSystemPreferenceService()
    {
        $this->getContainer()->get("partkeepr.system_preference_service")->setSystemPreference("foo", "bar");
        $this->assertEquals("bar", $this->getContainer()->get("partkeepr.system_preference_service")->getSystemPreferenceValue("foo"));
        $this->getContainer()->get("partkeepr.system_preference_service")->setSystemPreference("foo", "bar2");
        $this->assertEquals("bar2", $this->getContainer()->get("partkeepr.system_preference_service")->getSystemPreferenceValue("foo"));
        $preference = $this->getContainer()->get("partkeepr.system_preference_service")->getPreference("foo");
        $this->assertEquals("foo", $preference->getPreferenceKey());
        $this->expectException(SystemPreferenceNotFoundException::class);
        $this->assertEquals("bar2", $this->getContainer()->get("partkeepr.system_preference_service")->getSystemPreferenceValue("foo2"));
    }